← All changes
|
vendor-prefixed/src/Menu/ExternalPluginMenuAdapter.php
+4
-5
4.4.2
→
4.4.5
View file →
| @@ -2,14 +2,13 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace YayMailScoped\YayCommerce\AdminShell\Menu; |
| 4 | 4 | |
| 5 | 5 | use YayMailScoped\YayCommerce\AdminShell\Pages\RecommendedPluginsPage; |
| 6 | -\defined('ABSPATH') || exit; | |
| 6 | +defined('ABSPATH') || exit; | |
| 7 | 7 | /** |
| 8 | 8 | * Registers an "Other Plugins" submenu under an external plugin's own top-level menu. |
| 9 | 9 | * Used for plugins (e.g. whatsapp, filester) that own their own menu hierarchy |
| 10 | 10 | * and should NOT appear under the shared YayCommerce menu. |
| 11 | - * @internal | |
| 12 | 11 | */ |
| 13 | 12 | class ExternalPluginMenuAdapter |
| 14 | 13 | { |
| 15 | 14 | private string $parent_menu; |
| @@ -22,17 +21,17 @@ | ||
| 22 | 21 | $this->menu_title = 'Recommended Plugins'; |
| 23 | 22 | $this->menu_capability = $config['menu_capability'] ?? 'manage_options'; |
| 24 | 23 | $this->menu_slug = $config['menu_slug'] ?? ''; |
| 25 | 24 | } |
| 26 | - public function init() : void | |
| 25 | + public function init(): void | |
| 27 | 26 | { |
| 28 | 27 | RecommendedPluginsPage::get_instance(); |
| 29 | - if (!\is_admin()) { | |
| 28 | + if (!is_admin()) { | |
| 30 | 29 | return; |
| 31 | 30 | } |
| 32 | 31 | add_action('admin_menu', [$this, 'register_other_plugins_submenu'], 20); |
| 33 | 32 | } |
| 34 | - public function register_other_plugins_submenu() : void | |
| 33 | + public function register_other_plugins_submenu(): void | |
| 35 | 34 | { |
| 36 | 35 | $page_id = add_submenu_page($this->parent_menu, $this->menu_title, $this->menu_title, $this->menu_capability, $this->menu_slug, [RecommendedPluginsPage::class, 'render']); |
| 37 | 36 | add_action('load-' . $page_id, function () { |
| 38 | 37 | RecommendedPluginsPage::load_data(); |