Conditions | 3 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public function response($input): array |
||
30 | { |
||
31 | return [ |
||
32 | 'label' => $this->label, |
||
33 | 'name' => $this->name, |
||
34 | 'item_name' => $this->item_name === '' ? $this->item_name : 'Item', |
||
35 | 'response' => collect($input)->map(fn($repeatedFields) => $this->fields->map(function ($field) use ($repeatedFields) { |
||
36 | |||
37 | // Handle empty radio buttons and uncreated repeats (no fields made) |
||
38 | //if ($field instanceof \Riclep\StoryblokForms\Blocks\LsfRadioButton) { |
||
39 | if (!array_key_exists($field->name, $repeatedFields)) { |
||
40 | $repeatedFields[$field->name] = null; |
||
41 | } |
||
42 | //} |
||
43 | |||
44 | return $field->response($repeatedFields[$field->name]); |
||
45 | })->keyBy('name')->toArray())->toArray(), |
||
46 | 'type' => $this->type, |
||
47 | ]; |
||
49 | } |