Total Complexity | 3 |
Total Lines | 51 |
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' => [ |
||
15 | 'advanced', 'design', 'general', |
||
16 | ], |
||
17 | ]; |
||
18 | |||
19 | /** |
||
20 | * The keys that should be mapped to other keys. |
||
21 | * Keys are mapped before the values are normalized and sanitized. |
||
22 | * Note: Mapped keys should not be included in the defaults! |
||
23 | */ |
||
24 | public array $mapped = [ |
||
25 | 'label' => 'heading', |
||
26 | 'name' => 'param_name', |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * The values that should be sanitized. |
||
31 | * This is done after $casts and before $enums. |
||
32 | */ |
||
33 | public array $sanitize = [ |
||
34 | 'description' => 'text', // Flatsome does not support HTML in descriptions |
||
35 | ]; |
||
36 | |||
37 | protected function defaults(): array |
||
43 | ]; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Finalize provided values, this always runs last. |
||
48 | */ |
||
49 | protected function finalize(array $values = []): array |
||
60 |