| @@ -25,8 +25,14 @@ | ||
| 25 | 25 | |
| 26 | 26 | $ajax = new Ajax(); |
| 27 | 27 | $ajax->register_endpoints(); |
| 28 | 28 | |
| 29 | + add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu ) { | |
| 30 | + if ( ! $this->is_editor_one_active() ) { | |
| 31 | + $admin_menu->register( static::PAGE_ID, new Admin_Menu_App() ); | |
| 32 | + } | |
| 33 | + }, 25 ); | |
| 34 | + | |
| 29 | 35 | add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) { |
| 30 | 36 | $this->register_editor_one_menu( $menu_data_provider ); |
| 31 | 37 | } ); |
| 32 | 38 | |
| @@ -33,8 +39,12 @@ | ||
| 33 | 39 | add_action( 'elementor/editor-one/menu/after_register_hidden_submenus', function ( array $hooks ) { |
| 34 | 40 | $this->enqueue_assets_for_editor_one_menu( $hooks ); |
| 35 | 41 | } ); |
| 36 | 42 | |
| 43 | + add_action( 'elementor/admin/menu/after_register', function ( Admin_Menu_Manager $admin_menu, array $hooks ) { | |
| 44 | + $this->enqueue_assets_for_editor_one_menu( $hooks ); | |
| 45 | + }, 10, 2 ); | |
| 46 | + | |
| 37 | 47 | add_filter( 'elementor/widgets/is_widget_enabled', function( $should_register, Widget_Base $widget_instance ) { |
| 38 | 48 | return ! Options::is_element_disabled( $widget_instance->get_name() ); |
| 39 | 49 | }, 10, 2 ); |
| 40 | 50 | |
| @@ -67,8 +77,12 @@ | ||
| 67 | 77 | } |
| 68 | 78 | |
| 69 | 79 | private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ): void { |
| 70 | 80 | $menu_data_provider->register_menu( new Editor_One_Elements_Manager_Menu() ); |
| 81 | + } | |
| 82 | + | |
| 83 | + private function is_editor_one_active(): bool { | |
| 84 | + return (bool) Plugin::instance()->modules_manager->get_modules( 'editor-one' ); | |
| 71 | 85 | } |
| 72 | 86 | |
| 73 | 87 | public function enqueue_assets() { |
| 74 | 88 | wp_enqueue_script( |