PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.2
YayMail – WooCommerce Email Customizer v4.4.2
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
yaymail / vendor-prefixed / src / Menu / ExternalPluginMenuAdapter.php

ExternalPluginMenuAdapter.php in YayMail – WooCommerce Email Customizer 4.4.2, at vendor-prefixed/src/Menu/ExternalPluginMenuAdapter.php

42 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YayMailScoped\YayCommerce\AdminShell\Menu;
4
5 use YayMailScoped\YayCommerce\AdminShell\Pages\RecommendedPluginsPage;
6 \defined('ABSPATH') || exit;
7 /**
8 * Registers an "Other Plugins" submenu under an external plugin's own top-level menu.
9 * Used for plugins (e.g. whatsapp, filester) that own their own menu hierarchy
10 * and should NOT appear under the shared YayCommerce menu.
11 * @internal
12 */
13 class ExternalPluginMenuAdapter
14 {
15 private string $parent_menu;
16 private string $menu_title;
17 private string $menu_capability;
18 private string $menu_slug;
19 public function __construct(array $config)
20 {
21 $this->parent_menu = $config['parent_menu'] ?? '';
22 $this->menu_title = 'Recommended Plugins';
23 $this->menu_capability = $config['menu_capability'] ?? 'manage_options';
24 $this->menu_slug = $config['menu_slug'] ?? '';
25 }
26 public function init() : void
27 {
28 RecommendedPluginsPage::get_instance();
29 if (!\is_admin()) {
30 return;
31 }
32 add_action('admin_menu', [$this, 'register_other_plugins_submenu'], 20);
33 }
34 public function register_other_plugins_submenu() : void
35 {
36 $page_id = add_submenu_page($this->parent_menu, $this->menu_title, $this->menu_title, $this->menu_capability, $this->menu_slug, [RecommendedPluginsPage::class, 'render']);
37 add_action('load-' . $page_id, function () {
38 RecommendedPluginsPage::load_data();
39 });
40 }
41 }
42