| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Modules\ProInstall; |
| 3 | 3 | |
| 4 | +use Elementor\Core\Admin\Menu\Admin_Menu_Manager; | |
| 4 | 5 | use Elementor\Core\Common\Modules\Connect\Module as ConnectModule; |
| 5 | 6 | use Elementor\Core\Base\Module as BaseModule; |
| 6 | 7 | use Elementor\Plugin; |
| 7 | 8 | use Elementor\Utils; |
| @@ -29,8 +30,20 @@ | ||
| 29 | 30 | add_action( 'elementor/connect/apps/register', function ( ConnectModule $connect_module ) { |
| 30 | 31 | $connect_module->register_app( 'pro-install', Connect::get_class_name() ); |
| 31 | 32 | } ); |
| 32 | 33 | |
| 34 | + add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu ) { | |
| 35 | + if ( ! $this->is_editor_one_active() ) { | |
| 36 | + $admin_menu->register( | |
| 37 | + 'elementor-connect-account', | |
| 38 | + new Pro_Install_Menu_Item( | |
| 39 | + $this->get_connect_app(), | |
| 40 | + $this->get_pro_install_page_assets(), | |
| 41 | + ) | |
| 42 | + ); | |
| 43 | + } | |
| 44 | + }, 116 ); | |
| 45 | + | |
| 33 | 46 | add_action( 'elementor/editor-one/menu/excluded_level3_slugs', function ( array $excluded_slugs ): array { |
| 34 | 47 | $excluded_slugs[] = 'elementor-connect'; |
| 35 | 48 | return $excluded_slugs; |
| 36 | 49 | } ); |
| @@ -42,8 +55,12 @@ | ||
| 42 | 55 | $this->get_pro_install_page_assets() |
| 43 | 56 | ) |
| 44 | 57 | ); |
| 45 | 58 | } ); |
| 59 | + } | |
| 60 | + | |
| 61 | + private function is_editor_one_active(): bool { | |
| 62 | + return (bool) Plugin::instance()->modules_manager->get_modules( 'editor-one' ); | |
| 46 | 63 | } |
| 47 | 64 | |
| 48 | 65 | private function get_connect_app(): Connect { |
| 49 | 66 | return Plugin::$instance->common->get_component( 'connect' )->get_app( 'pro-install' ); |