| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\EditorOne\Classes; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
class Menu_Config { |
| 10 |
const ELEMENTOR_MENU_SLUG = 'elementor'; |
| 11 |
const ELEMENTOR_HOME_MENU_SLUG = 'elementor-home'; |
| 12 |
const EDITOR_MENU_SLUG = 'elementor-editor'; |
| 13 |
const TEMPLATES_GROUP_ID = 'elementor-editor-templates'; |
| 14 |
const SETTINGS_GROUP_ID = 'elementor-editor-settings'; |
| 15 |
const EDITOR_GROUP_ID = 'elementor-editor-items'; |
| 16 |
const CUSTOM_ELEMENTS_GROUP_ID = 'elementor-editor-custom-elements'; |
| 17 |
const SYSTEM_GROUP_ID = 'elementor-editor-system'; |
| 18 |
const THIRD_PARTY_GROUP_ID = 'elementor-editor-third-party'; |
| 19 |
const LEGACY_TEMPLATES_SLUG = 'edit.php?post_type=elementor_library'; |
| 20 |
const CAPABILITY_EDIT_POSTS = 'edit_posts'; |
| 21 |
const CAPABILITY_MANAGE_OPTIONS = 'manage_options'; |
| 22 |
const MENU_POSITION = 58.5; |
| 23 |
public static function get_excluded_level4_slugs(): array { |
| 24 |
// add new which is automatically added to templates and categories |
| 25 |
$default_slugs = [ |
| 26 |
'edit-tags.php?taxonomy=elementor_library_category&post_type=elementor_library', |
| 27 |
]; |
| 28 |
|
| 29 |
return apply_filters( 'elementor/editor-one/menu/excluded_level4_slugs', $default_slugs ); |
| 30 |
} |
| 31 |
|
| 32 |
public static function get_excluded_level3_slugs(): array { |
| 33 |
// elementor pro slugs |
| 34 |
$default_slugs = [ |
| 35 |
'elementor-theme-builder', |
| 36 |
'elementor-pro-notes-proxy', |
| 37 |
self::EDITOR_MENU_SLUG, |
| 38 |
]; |
| 39 |
|
| 40 |
return apply_filters( 'elementor/editor-one/menu/excluded_level3_slugs', $default_slugs ); |
| 41 |
} |
| 42 |
|
| 43 |
public static function get_excluded_flyout_menu_level3_slugs(): array { |
| 44 |
$default_slugs = [ |
| 45 |
'e-form-submissions', |
| 46 |
]; |
| 47 |
|
| 48 |
return apply_filters( 'elementor/editor-one/menu/excluded_flyout_menu_level3_slugs', $default_slugs ); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
public static function get_legacy_slug_mapping(): array { |
| 53 |
$default_mapping = [ |
| 54 |
self::LEGACY_TEMPLATES_SLUG => self::TEMPLATES_GROUP_ID, |
| 55 |
]; |
| 56 |
|
| 57 |
return apply_filters( 'elementor/editor-one/menu/legacy_slug_mapping', $default_mapping ); |
| 58 |
} |
| 59 |
|
| 60 |
public static function get_legacy_pro_mapping(): array { |
| 61 |
$default_mapping = [ |
| 62 |
'elementor-license' => [ 'group' => self::SYSTEM_GROUP_ID ], |
| 63 |
'e-form-submissions' => [ 'group' => self::EDITOR_GROUP_ID ], |
| 64 |
'edit.php?post_type=elementor_font' => [ |
| 65 |
'group' => self::CUSTOM_ELEMENTS_GROUP_ID, |
| 66 |
'label' => __( 'Fonts', 'elementor' ), |
| 67 |
], |
| 68 |
'edit.php?post_type=elementor_icons' => [ |
| 69 |
'group' => self::CUSTOM_ELEMENTS_GROUP_ID, |
| 70 |
'label' => __( 'Icons', 'elementor' ), |
| 71 |
], |
| 72 |
'edit.php?post_type=elementor_snippet' => [ |
| 73 |
'group' => self::CUSTOM_ELEMENTS_GROUP_ID, |
| 74 |
'label' => __( 'Code', 'elementor' ), |
| 75 |
], |
| 76 |
'e-custom-fonts' => [ |
| 77 |
'group' => self::CUSTOM_ELEMENTS_GROUP_ID, |
| 78 |
'label' => __( 'Fonts', 'elementor' ), |
| 79 |
], |
| 80 |
'e-custom-icons' => [ |
| 81 |
'group' => self::CUSTOM_ELEMENTS_GROUP_ID, |
| 82 |
'label' => __( 'Icons', 'elementor' ), |
| 83 |
], |
| 84 |
'e-custom-code' => [ |
| 85 |
'group' => self::CUSTOM_ELEMENTS_GROUP_ID, |
| 86 |
'label' => __( 'Code', 'elementor' ), |
| 87 |
], |
| 88 |
]; |
| 89 |
|
| 90 |
return apply_filters( 'elementor/editor-one/menu/legacy_pro_mapping', $default_mapping ); |
| 91 |
} |
| 92 |
|
| 93 |
public static function get_attribute_mapping(): array { |
| 94 |
$default_mapping = [ |
| 95 |
'e-form-submissions' => [ |
| 96 |
'position' => 70, |
| 97 |
'icon' => 'send', |
| 98 |
], |
| 99 |
]; |
| 100 |
|
| 101 |
return apply_filters( 'elementor/editor-one/menu/position_mapping', $default_mapping ); |
| 102 |
} |
| 103 |
|
| 104 |
public static function get_custom_code_url(): string { |
| 105 |
$pro_custom_code_cpt = 'elementor_snippet'; |
| 106 |
|
| 107 |
if ( post_type_exists( $pro_custom_code_cpt ) ) { |
| 108 |
$default_url = admin_url( 'edit.php?post_type=' . $pro_custom_code_cpt ); |
| 109 |
} else { |
| 110 |
$default_url = admin_url( 'admin.php?page=elementor_custom_code' ); |
| 111 |
} |
| 112 |
|
| 113 |
return apply_filters( 'elementor/editor-one/menu/custom_code_url', $default_url ); |
| 114 |
} |
| 115 |
|
| 116 |
public static function get_elementor_home_url(): string { |
| 117 |
return admin_url( 'admin.php?page=' . self::ELEMENTOR_MENU_SLUG ); |
| 118 |
} |
| 119 |
|
| 120 |
public static function get_elementor_post_types(): array { |
| 121 |
$default_values = [ |
| 122 |
'elementor_icons' => [ |
| 123 |
'menu_slug' => 'elementor-custom-elements', |
| 124 |
'child_slug' => 'edit.php?post_type=elementor_icons', |
| 125 |
], |
| 126 |
'elementor_font' => [ |
| 127 |
'menu_slug' => 'elementor-custom-elements', |
| 128 |
'child_slug' => 'edit.php?post_type=elementor_font', |
| 129 |
], |
| 130 |
'elementor_snippet' => [ |
| 131 |
'menu_slug' => 'elementor-custom-elements', |
| 132 |
'child_slug' => 'edit.php?post_type=elementor_snippet', |
| 133 |
], |
| 134 |
]; |
| 135 |
|
| 136 |
return apply_filters( 'elementor/editor-one/menu/elementor_post_types', $default_values ); |
| 137 |
} |
| 138 |
} |
| 139 |
|