| 1 |
<?php |
| 2 |
|
| 3 |
namespace YayMailScoped\YayCommerce\AdminShell\Pages; |
| 4 |
|
| 5 |
/** |
| 6 |
* Renders the shared "WooCommerce required" full-screen gate. |
| 7 |
* |
| 8 |
* Installed as the settings-page callback by PluginSubmenu when a plugin opts in |
| 9 |
* (adapter's optional needs_woocommerce_screen() returns true). Copy is |
| 10 |
* de-branded by default; a plugin may override any field via the adapter's |
| 11 |
* optional get_woocommerce_screen_copy() method. |
| 12 |
*/ |
| 13 |
class WooCommerceRequiredPage |
| 14 |
{ |
| 15 |
/** |
| 16 |
* @param array $copy Optional overrides: icon, title, text, button, hint. |
| 17 |
*/ |
| 18 |
public static function render(array $copy = []): void |
| 19 |
{ |
| 20 |
$copy = array_merge(self::defaults(), array_filter($copy)); |
| 21 |
include __DIR__ . '/../../views/woocommerce-required-page.php'; |
| 22 |
} |
| 23 |
/** |
| 24 |
* Generic, de-branded default copy. |
| 25 |
*/ |
| 26 |
private static function defaults(): array |
| 27 |
{ |
| 28 |
return ['icon' => '🛒', 'title' => __('WooCommerce is required', 'yaycommerce'), 'text' => __('This plugin extends WooCommerce, so it needs WooCommerce installed and activated. Install WooCommerce to get started.', 'yaycommerce'), 'button' => __('Install WooCommerce', 'yaycommerce'), 'hint' => __('Already installed it? Activate WooCommerce, then reload this page.', 'yaycommerce')]; |
| 29 |
} |
| 30 |
} |
| 31 |
|