| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Core\Admin\EditorOneMenu\Menu; |
| 4 |
|
| 5 |
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Third_Level_Interface; |
| 6 |
use Elementor\Modules\EditorOne\Classes\Menu_Config; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
class Legacy_Submenu_Item implements Menu_Item_Third_Level_Interface { |
| 13 |
|
| 14 |
private $submenu_data; |
| 15 |
|
| 16 |
private $parent_slug; |
| 17 |
|
| 18 |
private $position; |
| 19 |
|
| 20 |
public function __construct( array $submenu_data, ?string $parent_slug = null, ?int $position = 100 ) { |
| 21 |
$this->submenu_data = $submenu_data; |
| 22 |
$this->parent_slug = $parent_slug ?? Menu_Config::ELEMENTOR_MENU_SLUG; |
| 23 |
$this->position = $position; |
| 24 |
} |
| 25 |
|
| 26 |
public function get_label(): string { |
| 27 |
return $this->submenu_data[0] ?? ''; |
| 28 |
} |
| 29 |
|
| 30 |
public function get_capability(): string { |
| 31 |
return $this->submenu_data[1] ?? Menu_Config::CAPABILITY_MANAGE_OPTIONS; |
| 32 |
} |
| 33 |
|
| 34 |
public function get_slug(): string { |
| 35 |
return $this->submenu_data[2] ?? ''; |
| 36 |
} |
| 37 |
|
| 38 |
public function get_parent_slug(): string { |
| 39 |
return $this->parent_slug; |
| 40 |
} |
| 41 |
|
| 42 |
public function is_visible(): bool { |
| 43 |
return true; |
| 44 |
} |
| 45 |
|
| 46 |
public function get_page_title(): string { |
| 47 |
return $this->submenu_data[3] ?? $this->get_label(); |
| 48 |
} |
| 49 |
|
| 50 |
public function get_position(): int { |
| 51 |
return $this->position; |
| 52 |
} |
| 53 |
|
| 54 |
public function get_group_id(): string { |
| 55 |
return $this->submenu_data[4] ?? Menu_Config::EDITOR_GROUP_ID; |
| 56 |
} |
| 57 |
|
| 58 |
public function get_icon(): string { |
| 59 |
$item_slug = $this->get_slug(); |
| 60 |
$icon = Menu_Config::get_attribute_mapping()[ $item_slug ]['icon'] ?? 'admin-generic'; |
| 61 |
|
| 62 |
return $icon; |
| 63 |
} |
| 64 |
|
| 65 |
public function has_children(): bool { |
| 66 |
return false; |
| 67 |
} |
| 68 |
} |
| 69 |
|