PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.3
Elementor Website Builder – more than just a page builder v4.2.3
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.2.3, at modules/editor-one/module.php

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