| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Core\RoleManager; |
| 3 | 3 | |
| 4 | +use Elementor\Core\Admin\Menu\Admin_Menu_Manager; | |
| 4 | 5 | use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; |
| 5 | 6 | use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider; |
| 6 | 7 | use Elementor\Plugin; |
| 7 | 8 | use Elementor\Settings; |
| @@ -51,8 +52,16 @@ | ||
| 51 | 52 | } |
| 52 | 53 | |
| 53 | 54 | /** |
| 54 | 55 | * @since 2.0.0 |
| 56 | + * @access public | |
| 57 | + */ | |
| 58 | + public function register_admin_menu( Admin_Menu_Manager $admin_menu ) { | |
| 59 | + $admin_menu->register( static::PAGE_ID, new Role_Manager_Menu_Item( $this ) ); | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * @since 2.0.0 | |
| 55 | 64 | * @access protected |
| 56 | 65 | */ |
| 57 | 66 | protected function create_tabs() { |
| 58 | 67 | $validation_class = 'Elementor\Settings_Validations'; |
| @@ -136,9 +145,13 @@ | ||
| 136 | 145 | if ( false === $excluded_options ) { |
| 137 | 146 | $excluded_options = $this->get_role_manager_options(); |
| 138 | 147 | } |
| 139 | 148 | |
| 140 | - $row_classes = 'elementor-role-row ' . esc_attr( $role_slug ) . ' e-editor-one'; | |
| 149 | + $is_editor_one_enabled = Plugin::$instance->experiments->is_feature_active( 'e_editor_one' ); | |
| 150 | + $row_classes = 'elementor-role-row ' . esc_attr( $role_slug ); | |
| 151 | + if ( $is_editor_one_enabled ) { | |
| 152 | + $row_classes .= ' e-editor-one'; | |
| 153 | + } | |
| 141 | 154 | |
| 142 | 155 | ?> |
| 143 | 156 | <div class="<?php echo esc_attr( $row_classes ); ?>"> |
| 144 | 157 | <div class="elementor-role-label"> |
| @@ -306,8 +319,12 @@ | ||
| 306 | 319 | private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) { |
| 307 | 320 | $menu_data_provider->register_menu( new Editor_One_Role_Manager_Menu() ); |
| 308 | 321 | } |
| 309 | 322 | |
| 323 | + private function is_editor_one_active(): bool { | |
| 324 | + return (bool) Plugin::instance()->modules_manager->get_modules( 'editor-one' ); | |
| 325 | + } | |
| 326 | + | |
| 310 | 327 | /** |
| 311 | 328 | * @since 2.0.0 |
| 312 | 329 | * @access public |
| 313 | 330 | */ |
| @@ -312,8 +329,14 @@ | ||
| 312 | 329 | * @access public |
| 313 | 330 | */ |
| 314 | 331 | public function __construct() { |
| 315 | 332 | parent::__construct(); |
| 333 | + | |
| 334 | + add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) { | |
| 335 | + if ( ! $this->is_editor_one_active() ) { | |
| 336 | + $this->register_admin_menu( $admin_menu ); | |
| 337 | + } | |
| 338 | + }, Settings::ADMIN_MENU_PRIORITY + 10 ); | |
| 316 | 339 | |
| 317 | 340 | add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) { |
| 318 | 341 | $this->register_editor_one_menu( $menu_data_provider ); |
| 319 | 342 | } ); |