| 1 |
<?php |
| 2 |
/** |
| 3 |
* License Settings Section. |
| 4 |
* |
| 5 |
* @package WCPOS\WooCommercePOS |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WCPOS\WooCommercePOS\Services\Settings; |
| 9 |
|
| 10 |
/** |
| 11 |
* The License Settings Section. |
| 12 |
* |
| 13 |
* In the free plugin this is a shim: the view is whatever the Pro plugin |
| 14 |
* injects via the woocommerce_pos_license_settings filter (empty array |
| 15 |
* otherwise). A follow-up Pro PR replaces the filter hook with a real |
| 16 |
* registered section via woocommerce_pos_register_settings_sections. |
| 17 |
* |
| 18 |
* NOTE: write() is not overridden — it inherits Abstract_Section::write() |
| 19 |
* and persists to woocommerce_pos_settings_license — but read() never |
| 20 |
* consults that option; persisted data is silently ignored until Pro |
| 21 |
* overrides this section. (Legacy save_settings('license') behaved the |
| 22 |
* same way; preserved deliberately.) |
| 23 |
*/ |
| 24 |
class License_Section extends Abstract_Section { |
| 25 |
/** |
| 26 |
* Section id. |
| 27 |
*/ |
| 28 |
public function id(): string { |
| 29 |
return 'license'; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* No defaults; the view is Pro-injected. |
| 34 |
*/ |
| 35 |
public function defaults(): array { |
| 36 |
return array(); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Read the license view from the Pro-injected filter. |
| 41 |
*/ |
| 42 |
public function read(): array { |
| 43 |
/** |
| 44 |
* Filters the license settings. |
| 45 |
* |
| 46 |
* @since 1.0.0 |
| 47 |
* |
| 48 |
* @param array $settings The license settings. |
| 49 |
* |
| 50 |
* @hook woocommerce_pos_license_settings |
| 51 |
*/ |
| 52 |
return apply_filters( 'woocommerce_pos_license_settings', array() ); |
| 53 |
} |
| 54 |
} |
| 55 |
|