/var/www/html_us/wp-content/plugins/elementor/core/admin/menu/main.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php

namespace Elementor\Core\Admin\Menu;

use 
Elementor\Plugin;
use 
Elementor\TemplateLibrary\Source_Local;
use 
Elementor\Tools;

if ( ! 
defined'ABSPATH' ) ) {
    exit; 
// Exit if accessed directly
}

class 
Main extends Base {

    protected function 
get_init_args() {
        return [
            
'page_title' => esc_html__'Elementor''elementor' ),
            
'menu_title' => esc_html__'Elementor''elementor' ),
            
'capability' => 'manage_options',
            
'menu_slug' => 'elementor',
            
'function' => [ Plugin::$instance->settings'display_settings_page' ],
            
'position' => 58.5,
        ];
    }

    protected function 
get_init_options() {
        return [
            
'separator' => true,
        ];
    }

    protected function 
register_default_submenus() {
        
$this->add_submenu( [
            
'page_title' => esc_html_x'Templates''Template Library''elementor' ),
            
'menu_title' => esc_html_x'Templates''Template Library''elementor' ),
            
'menu_slug' => Source_Local::ADMIN_MENU_SLUG,
            
'index' => 0,
        ] );

        
$this->add_submenu( [
            
'menu_title' => esc_html__'Help''elementor' ),
            
'menu_slug' => 'go_knowledge_base_site',
            
'function' => [ Plugin::$instance->settings'handle_external_redirects' ],
            
'index' => 150,
        ] );
    }

    protected function 
register() {
        
parent::register();

        
$this->rearrange_elementor_submenu();
    }

    private function 
rearrange_elementor_submenu() {
        global 
$submenu;

        
$elementor_menu_slug $this->get_args'menu_slug' );

        
$elementor_submenu_old_index null;

        
$tools_submenu_index null;

        foreach ( 
$submenu$elementor_menu_slug ] as $index => $submenu_item ) {
            if ( 
$elementor_menu_slug === $submenu_item[2] ) {
                
$elementor_submenu_old_index $index;
            } elseif ( 
Tools::PAGE_ID === $submenu_item[2] ) {
                
$tools_submenu_index $index;

                break;
            }
        }

        
$elementor_submenu array_splice$submenu$elementor_menu_slug ], $elementor_submenu_old_index);

        
$elementor_submenu[0][0] = esc_html__'Settings''elementor' );

        
array_splice$submenu$elementor_menu_slug ], $tools_submenu_index0$elementor_submenu );
    }
}