| @@ -1,9 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | +use Elementor\Core\Admin\Menu\Admin_Menu_Manager; | |
| 4 | 5 | use Elementor\Core\Admin\Menu\Main as MainMenu; |
| 5 | 6 | use Elementor\Core\Kits\Manager; |
| 7 | +use Elementor\Includes\Settings\AdminMenuItems\Tools_Menu_Item; | |
| 6 | 8 | |
| 7 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 10 | exit; // Exit if accessed directly. |
| 9 | 11 | } |
| @@ -33,29 +35,8 @@ | ||
| 33 | 35 | ] ); |
| 34 | 36 | } |
| 35 | 37 | |
| 36 | 38 | /** |
| 37 | - * Register admin menu legacy. | |
| 38 | - * | |
| 39 | - * Add new Elementor Tools admin menu. | |
| 40 | - * | |
| 41 | - * Fired by `admin_menu` action. | |
| 42 | - * | |
| 43 | - * @since 1.0.0 | |
| 44 | - * @access private | |
| 45 | - */ | |
| 46 | - private function register_admin_menu_legacy() { | |
| 47 | - add_submenu_page( | |
| 48 | - Settings::PAGE_ID, | |
| 49 | - esc_html__( 'Tools', 'elementor' ), | |
| 50 | - esc_html__( 'Tools', 'elementor' ), | |
| 51 | - 'manage_options', | |
| 52 | - self::PAGE_ID, | |
| 53 | - [ $this, 'display_settings_page' ] | |
| 54 | - ); | |
| 55 | - } | |
| 56 | - | |
| 57 | - /** | |
| 58 | 39 | * Clear cache. |
| 59 | 40 | * |
| 60 | 41 | * Delete post meta containing the post CSS file data. And delete the actual |
| 61 | 42 | * CSS files from the upload directory. |
| @@ -185,11 +166,11 @@ | ||
| 185 | 166 | add_action( 'elementor/admin/menu_registered/elementor', function( MainMenu $menu ) { |
| 186 | 167 | $this->register_admin_menu( $menu ); |
| 187 | 168 | } ); |
| 188 | 169 | } else { |
| 189 | - add_action( 'admin_menu', function() { | |
| 190 | - $this->register_admin_menu_legacy(); | |
| 191 | - }, 205 ); | |
| 170 | + add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu ) { | |
| 171 | + $admin_menu->register( static::PAGE_ID, new Tools_Menu_Item( $this ) ); | |
| 172 | + }, Settings::ADMIN_MENU_PRIORITY + 20 ); | |
| 192 | 173 | } |
| 193 | 174 | |
| 194 | 175 | add_action( 'wp_ajax_elementor_clear_cache', [ $this, 'ajax_elementor_clear_cache' ] ); |
| 195 | 176 | add_action( 'wp_ajax_elementor_replace_url', [ $this, 'ajax_elementor_replace_url' ] ); |