TogglePromotion.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Setting\ComponentFactory\Pro; |
| 6 | |
| 7 | use AC\Setting\ComponentFactory\BaseComponentFactory; |
| 8 | use AC\Setting\Config; |
| 9 | use AC\Setting\Control\Input; |
| 10 | |
| 11 | class TogglePromotion extends BaseComponentFactory |
| 12 | { |
| 13 | private string $label; |
| 14 | |
| 15 | private string $feature; |
| 16 | |
| 17 | public function __construct(string $label, string $feature = '') |
| 18 | { |
| 19 | $this->label = $label; |
| 20 | $this->feature = $feature; |
| 21 | } |
| 22 | |
| 23 | protected function get_label(Config $config): ?string |
| 24 | { |
| 25 | return $this->label; |
| 26 | } |
| 27 | |
| 28 | protected function get_input(Config $config): ?Input |
| 29 | { |
| 30 | return new Input\Custom('pro_feature', 'pro_feature', [ |
| 31 | 'feature' => $this->feature, |
| 32 | ]); |
| 33 | } |
| 34 | |
| 35 | } |
| 36 |