Conditions | 5 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
42 | protected function finalize(array $values = []): array |
||
43 | { |
||
44 | $types = [ |
||
45 | 'checkbox' => 'checkbox', |
||
46 | 'number' => 'glsr_type_range', |
||
47 | 'select' => 'dropdown', |
||
48 | 'text' => 'textfield', |
||
49 | ]; |
||
50 | if (array_key_exists($values['type'], $types)) { |
||
51 | $values['type'] = $types[$values['type']]; |
||
52 | } |
||
53 | if ('dropdown' === $values['type'] |
||
54 | && !isset($values['options']) |
||
55 | && !isset($values['value'])) { |
||
56 | $values['type'] = 'autocomplete'; |
||
57 | $values['settings'] = [ |
||
58 | 'multiple' => true, |
||
59 | 'sortable' => true, |
||
60 | ]; |
||
61 | } |
||
62 | return $values; |
||
63 | } |
||
65 |