PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.2
Elementor Website Builder – more than just a page builder v4.1.2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / editor-one / module.php

module.php in Elementor Website Builder – more than just a page builder 4.1.2, at modules/editor-one/module.php

113 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\EditorOne;
4
5 use Elementor\Core\Admin\EditorOneMenu\Elementor_One_Menu_Manager;
6 use Elementor\Core\Base\Module as BaseModule;
7 use Elementor\Modules\EditorOne\Classes\Editor_One_Pointer;
8 use Elementor\Modules\EditorOne\Classes\Menu_Config;
9 use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
10 use Elementor\Modules\EditorOne\Components\Sidebar_Navigation_Handler;
11 use Elementor\Modules\EditorOne\Components\Top_Bar_Handler;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16 class Module extends BaseModule {
17
18 const CUSTOM_REACT_APP_PAGES = [
19 'elementor-element-manager',
20 ];
21
22 public function get_name(): string {
23 return 'editor-one';
24 }
25
26 public function __construct() {
27 parent::__construct();
28
29 if ( is_admin() ) {
30 $this->add_component( 'editor-one-menu-manager', new Elementor_One_Menu_Manager() );
31 $this->add_component( 'sidebar-navigation-handler', new Sidebar_Navigation_Handler() );
32 $this->add_component( 'top-bar-handler', new Top_Bar_Handler() );
33 $this->add_component( 'editor-one-pointer', new Editor_One_Pointer() );
34 }
35
36 add_action( 'current_screen', function () {
37 $menu_data_provider = Menu_Data_Provider::instance();
38
39 if ( ! $menu_data_provider->is_editor_one_admin_page() ) {
40 return;
41 }
42
43 add_action( 'admin_enqueue_scripts', function () {
44 $this->enqueue_styles();
45 } );
46 } );
47
48 add_filter( 'elementor/admin-top-bar/is-active', function ( $_is_active ) {
49 return false;
50 } );
51 }
52
53 /**
54 * Check if current page has a custom React app that uses @elementor/ui
55 *
56 * @return bool
57 */
58 private function is_custom_react_app_page() {
59 $current_screen = get_current_screen();
60
61 if ( ! $current_screen ) {
62 return false;
63 }
64
65 foreach ( self::CUSTOM_REACT_APP_PAGES as $page_slug ) {
66 if ( str_contains( $current_screen->id ?? '', $page_slug ) ) {
67 return true;
68 }
69 }
70
71 return false;
72 }
73
74 /**
75 * Enqueue admin styles
76 */
77 private function enqueue_styles() {
78
79 wp_enqueue_style( 'elementor-admin' );
80
81 wp_enqueue_style(
82 'elementor-editor-one-common',
83 $this->get_css_assets_url( 'editor-one-common' ),
84 [ 'elementor-admin' ],
85 ELEMENTOR_VERSION
86 );
87
88 if ( ! $this->is_custom_react_app_page() ) {
89 wp_enqueue_style(
90 'elementor-editor-one-elements',
91 $this->get_css_assets_url( 'editor-one-elements' ),
92 [ 'elementor-editor-one-common' ],
93 ELEMENTOR_VERSION
94 );
95
96 wp_enqueue_style(
97 'elementor-editor-one-tables',
98 $this->get_css_assets_url( 'editor-one-tables' ),
99 [ 'elementor-editor-one-common' ],
100 ELEMENTOR_VERSION
101 );
102 }
103
104 wp_enqueue_script(
105 'editor-one-admin',
106 $this->get_js_assets_url( 'editor-one-admin' ),
107 [ 'jquery' ],
108 ELEMENTOR_VERSION,
109 true
110 );
111 }
112 }
113