PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.5
YayMail – WooCommerce Email Customizer v4.4.5
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
← All changes | vendor-prefixed/src/Menu/MenuSuppressor.php +8 -6 4.4.1 → 4.4.5 View file →
@@ -1,8 +1,9 @@
1 1 <?php
2 2
3 3 namespace YayMailScoped\YayCommerce\AdminShell\Menu;
4 4
5 +use YayMailScoped\YayCommerce\AdminShell\Support\AdminContext;
5 6 /**
6 7 * Strategy (a) — removes legacy per-plugin top-level menu slugs before
7 8 * the shared YayCommerce menu is registered.
8 9 *
@@ -35,21 +36,22 @@
35 36 // TopLevelMenu's first-to-register guard. Keep this list explicit.
36 37 $this->slugs_to_suppress = $slugs ?? [];
37 38 }
38 39 /**
39 - * Register hooks. Runs on admin_menu priority 5 (before standard priority 10).
40 + * Register hooks. Runs on admin_menu / network_admin_menu priority 5
41 + * (before standard priority 10).
40 42 */
41 - public function init() : void
43 + public function init(): void
42 44 {
43 - \add_action('admin_menu', [$this, 'suppress_legacy_menus'], 5);
45 + AdminContext::bind_menu([$this, 'suppress_legacy_menus'], 5);
44 46 }
45 47 /**
46 48 * Remove any legacy top-level menus from the slug list.
47 49 */
48 - public function suppress_legacy_menus() : void
50 + public function suppress_legacy_menus(): void
49 51 {
50 52 foreach ($this->slugs_to_suppress as $slug) {
51 - \remove_menu_page($slug);
53 + remove_menu_page($slug);
52 54 }
53 55 }
54 56 /**
55 57 * Return the list of slugs this suppressor will remove.
@@ -55,9 +57,9 @@
55 57 * Return the list of slugs this suppressor will remove.
56 58 *
57 59 * @return string[]
58 60 */
59 - public function get_slugs() : array
61 + public function get_slugs(): array
60 62 {
61 63 return $this->slugs_to_suppress;
62 64 }
63 65 }