Conditions | 3 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public function response($input) { |
||
12 | return [ |
||
13 | 'label' => $this->label, |
||
|
|||
14 | 'response' => collect($input)->map(function ($repeatedFields) { |
||
15 | return $this->fields->map(function ($field) use ($repeatedFields) { |
||
16 | // Handle empty radio buttons sending nothing in POST request |
||
17 | if ($field instanceof \Riclep\StoryblokForms\Blocks\LsfRadioButton) { |
||
18 | if (!array_key_exists($field->name, $repeatedFields)) { |
||
19 | $repeatedFields[$field->name] = null; |
||
20 | } |
||
21 | } |
||
22 | |||
23 | return $field->response($repeatedFields[$field->name]); |
||
24 | }); |
||
28 | } |