Base.php
3 months ago
BaseColumnFactory.php
3 months ago
ColumnFactory.php
3 months ago
ColumnIdGenerator.php
3 months ago
ColumnLabelTrait.php
3 months ago
Context.php
3 months ago
CustomFieldContext.php
3 months ago
GroupTrait.php
3 months ago
LabelEncoder.php
3 months ago
SettingUpdater.php
3 months ago
Context.php
58 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Column; |
| 6 | |
| 7 | use AC; |
| 8 | use AC\Setting\Config; |
| 9 | |
| 10 | class Context implements AC\Setting\Context |
| 11 | { |
| 12 | |
| 13 | protected Config $config; |
| 14 | |
| 15 | private string $label; |
| 16 | |
| 17 | public function __construct(Config $config, string $label) |
| 18 | { |
| 19 | $this->config = $config; |
| 20 | $this->label = $label; |
| 21 | } |
| 22 | |
| 23 | public function get_type(): string |
| 24 | { |
| 25 | return $this->get('type'); |
| 26 | } |
| 27 | |
| 28 | public function get_name(): string |
| 29 | { |
| 30 | return $this->get('name', ''); |
| 31 | } |
| 32 | |
| 33 | public function get_label(): string |
| 34 | { |
| 35 | return $this->get('label', ''); |
| 36 | } |
| 37 | |
| 38 | public function get_type_label(): string |
| 39 | { |
| 40 | return $this->label; |
| 41 | } |
| 42 | |
| 43 | public function has(string $key): bool |
| 44 | { |
| 45 | return $this->config->has($key); |
| 46 | } |
| 47 | |
| 48 | public function get(string $key, $default = null) |
| 49 | { |
| 50 | return $this->config->get($key, $default); |
| 51 | } |
| 52 | |
| 53 | public function all(): array |
| 54 | { |
| 55 | return $this->config->all(); |
| 56 | } |
| 57 | |
| 58 | } |