← All changes
|
vendor-prefixed/src/Contracts/PluginMenuAdapter.php
+42
-11
4.4.1
→
4.4.5
View file →
| @@ -11,44 +11,75 @@ | ||
| 11 | 11 | { |
| 12 | 12 | /** |
| 13 | 13 | * Short name for the admin sidebar submenu item, e.g. 'YayMail'. |
| 14 | 14 | */ |
| 15 | - public function get_menu_title() : string; | |
| 15 | + public function get_menu_title(): string; | |
| 16 | 16 | /** |
| 17 | 17 | * Browser tab title for the settings page, e.g. 'YayMail Pro - Settings'. |
| 18 | 18 | */ |
| 19 | - public function get_page_title() : string; | |
| 19 | + public function get_page_title(): string; | |
| 20 | 20 | /** |
| 21 | 21 | * Menu slug under YayCommerce, e.g. 'yaymail-settings'. |
| 22 | 22 | * Return empty string if plugin has no settings page. |
| 23 | 23 | */ |
| 24 | - public function get_menu_slug() : string; | |
| 24 | + public function get_menu_slug(): string; | |
| 25 | 25 | /** |
| 26 | 26 | * Render callback for the settings page. |
| 27 | 27 | * Return null to redirect to the Licenses page (pro) or show nothing (lite). |
| 28 | 28 | */ |
| 29 | - public function get_settings_page_callback() : ?callable; | |
| 29 | + public function get_settings_page_callback(): ?callable; | |
| 30 | 30 | /** |
| 31 | - * Position of the plugin submenu. Return null for WP default ordering. | |
| 31 | + * Ordering rank of the plugin submenu under the YayCommerce menu. | |
| 32 | + * Lower numbers appear first; ties keep registration order. Values may be | |
| 33 | + * sparse (e.g. 10, 20, 21, 40). Return null to append after positioned items. | |
| 32 | 34 | */ |
| 33 | - public function get_settings_page_position() : ?int; | |
| 35 | + public function get_settings_page_position(): ?int; | |
| 34 | 36 | /** |
| 35 | 37 | * WP capability required. Default: 'manage_options'. |
| 36 | 38 | */ |
| 37 | - public function get_capability() : string; | |
| 39 | + public function get_capability(): string; | |
| 38 | 40 | /** |
| 39 | 41 | * WP plugin basename, e.g. 'yaymail-pro/yaymail.php'. |
| 40 | 42 | */ |
| 41 | - public function get_plugin_basename() : string; | |
| 43 | + public function get_plugin_basename(): string; | |
| 42 | 44 | /** |
| 43 | 45 | * Label for the settings action link on the Plugins page. |
| 44 | 46 | */ |
| 45 | - public function get_settings_label() : string; | |
| 47 | + public function get_settings_label(): string; | |
| 46 | 48 | /** |
| 47 | 49 | * Documentation URL. Return empty string to hide the link. |
| 48 | 50 | */ |
| 49 | - public function get_docs_url() : string; | |
| 51 | + public function get_docs_url(): string; | |
| 50 | 52 | /** |
| 51 | 53 | * "Go Pro" upgrade URL (for lite plugins). Return empty string to hide. |
| 52 | 54 | */ |
| 53 | - public function get_pro_url() : string; | |
| 55 | + public function get_pro_url(): string; | |
| 56 | + /* | |
| 57 | + * ── Optional capability methods (NOT part of the interface contract) ── | |
| 58 | + * | |
| 59 | + * These are detected at runtime via method_exists() (see AdminContext), | |
| 60 | + * so adapters MAY implement them without breaking the append-only contract. | |
| 61 | + * Declaring them here would force every shipped adapter to implement them. | |
| 62 | + * | |
| 63 | + * Multisite Network Admin placement (defaults preserve legacy behavior): | |
| 64 | + * | |
| 65 | + * // Submenu shows on each site's dashboard. Absent ⇒ true. | |
| 66 | + * public function wants_site_menu(): bool; | |
| 67 | + * | |
| 68 | + * // Submenu shows in the Multisite Network Admin. Absent ⇒ false. | |
| 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; | |
| 84 | + */ | |
| 54 | 85 | } |