← All changes
|
vendor-prefixed/src/Contracts/PluginMenuAdapter.php
+24
-11
4.4.2
→
4.4.5
View file →
| @@ -5,9 +5,8 @@ | ||
| 5 | 5 | /** |
| 6 | 6 | * Minimal per-plugin config for menu registration. |
| 7 | 7 | * All plugins (lite + pro) implement this. |
| 8 | 8 | * Pro plugins implement LicenseConfigAdapter which extends this. |
| 9 | - * @internal | |
| 10 | 9 | */ |
| 11 | 10 | interface PluginMenuAdapter |
| 12 | 11 | { |
| 13 | 12 | /** |
| @@ -12,49 +11,49 @@ | ||
| 12 | 11 | { |
| 13 | 12 | /** |
| 14 | 13 | * Short name for the admin sidebar submenu item, e.g. 'YayMail'. |
| 15 | 14 | */ |
| 16 | - public function get_menu_title() : string; | |
| 15 | + public function get_menu_title(): string; | |
| 17 | 16 | /** |
| 18 | 17 | * Browser tab title for the settings page, e.g. 'YayMail Pro - Settings'. |
| 19 | 18 | */ |
| 20 | - public function get_page_title() : string; | |
| 19 | + public function get_page_title(): string; | |
| 21 | 20 | /** |
| 22 | 21 | * Menu slug under YayCommerce, e.g. 'yaymail-settings'. |
| 23 | 22 | * Return empty string if plugin has no settings page. |
| 24 | 23 | */ |
| 25 | - public function get_menu_slug() : string; | |
| 24 | + public function get_menu_slug(): string; | |
| 26 | 25 | /** |
| 27 | 26 | * Render callback for the settings page. |
| 28 | 27 | * Return null to redirect to the Licenses page (pro) or show nothing (lite). |
| 29 | 28 | */ |
| 30 | - public function get_settings_page_callback() : ?callable; | |
| 29 | + public function get_settings_page_callback(): ?callable; | |
| 31 | 30 | /** |
| 32 | 31 | * Ordering rank of the plugin submenu under the YayCommerce menu. |
| 33 | 32 | * Lower numbers appear first; ties keep registration order. Values may be |
| 34 | 33 | * sparse (e.g. 10, 20, 21, 40). Return null to append after positioned items. |
| 35 | 34 | */ |
| 36 | - public function get_settings_page_position() : ?int; | |
| 35 | + public function get_settings_page_position(): ?int; | |
| 37 | 36 | /** |
| 38 | 37 | * WP capability required. Default: 'manage_options'. |
| 39 | 38 | */ |
| 40 | - public function get_capability() : string; | |
| 39 | + public function get_capability(): string; | |
| 41 | 40 | /** |
| 42 | 41 | * WP plugin basename, e.g. 'yaymail-pro/yaymail.php'. |
| 43 | 42 | */ |
| 44 | - public function get_plugin_basename() : string; | |
| 43 | + public function get_plugin_basename(): string; | |
| 45 | 44 | /** |
| 46 | 45 | * Label for the settings action link on the Plugins page. |
| 47 | 46 | */ |
| 48 | - public function get_settings_label() : string; | |
| 47 | + public function get_settings_label(): string; | |
| 49 | 48 | /** |
| 50 | 49 | * Documentation URL. Return empty string to hide the link. |
| 51 | 50 | */ |
| 52 | - public function get_docs_url() : string; | |
| 51 | + public function get_docs_url(): string; | |
| 53 | 52 | /** |
| 54 | 53 | * "Go Pro" upgrade URL (for lite plugins). Return empty string to hide. |
| 55 | 54 | */ |
| 56 | - public function get_pro_url() : string; | |
| 55 | + public function get_pro_url(): string; | |
| 57 | 56 | /* |
| 58 | 57 | * ── Optional capability methods (NOT part of the interface contract) ── |
| 59 | 58 | * |
| 60 | 59 | * These are detected at runtime via method_exists() (see AdminContext), |
| @@ -67,6 +66,20 @@ | ||
| 67 | 66 | * public function wants_site_menu(): bool; |
| 68 | 67 | * |
| 69 | 68 | * // Submenu shows in the Multisite Network Admin. Absent ⇒ false. |
| 70 | 69 | * public function wants_network_menu(): bool; |
| 70 | + * | |
| 71 | + * WooCommerce dependency gate (see PluginSubmenu + Pages\WooCommerceRequiredPage): | |
| 72 | + * | |
| 73 | + * // Render the shared "WooCommerce required" screen in place of the settings | |
| 74 | + * // page. Absent ⇒ false. The adapter owns the runtime check (typically | |
| 75 | + * // `! class_exists( 'WooCommerce' )`) so it evaluates un-prefixed under | |
| 76 | + * // PHP-Scoper — the adapter class is excluded from scoping in each plugin. | |
| 77 | + * // The license redirect takes precedence: unlicensed pro plugins still go | |
| 78 | + * // to the Licenses page even when this returns true. | |
| 79 | + * public function needs_woocommerce_screen(): bool; | |
| 80 | + * | |
| 81 | + * // Optional copy overrides for that screen: { icon, title, text, button, hint }. | |
| 82 | + * // Absent ⇒ generic de-branded defaults are used. | |
| 83 | + * public function get_woocommerce_screen_copy(): array; | |
| 71 | 84 | */ |
| 72 | 85 | } |