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