Total Complexity | 6 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class ControlDefaults extends DefaultsAbstract |
||
8 | { |
||
9 | /** |
||
10 | * The values that should be constrained after sanitization is run. |
||
11 | * This is done after $casts and $sanitize. |
||
12 | */ |
||
13 | public array $enums = [ |
||
14 | 'group' => ['advanced', 'design', 'general'], |
||
15 | ]; |
||
16 | |||
17 | /** |
||
18 | * The keys that should be mapped to other keys. |
||
19 | * Keys are mapped before the values are normalized and sanitized. |
||
20 | * Note: Mapped keys should not be included in the defaults! |
||
21 | */ |
||
22 | public array $mapped = [ |
||
23 | 'default' => 'std', |
||
24 | 'label' => 'heading', |
||
25 | 'name' => 'param_name', |
||
26 | ]; |
||
27 | |||
28 | protected function defaults(): array |
||
29 | { |
||
30 | return [ |
||
31 | 'group' => 'general', |
||
32 | 'heading' => '', |
||
33 | 'param_name' => '', |
||
34 | 'std' => '', |
||
35 | 'type' => 'textfield', |
||
36 | ]; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Finalize provided values, this always runs last. |
||
41 | */ |
||
42 | protected function finalize(array $values = []): array |
||
63 | } |
||
64 | } |
||
65 |