| Conditions | 2 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function response($input) { |
||
| 17 | return [ |
||
| 18 | 'label' => $this->label, |
||
| 19 | 'response' => collect($input)->map(function ($repeatedFields) { |
||
| 20 | return $this->fields->map(function ($field) use ($repeatedFields) { |
||
| 21 | |||
| 22 | // Handle empty radio buttons and uncreated repeats (no fields made) |
||
| 23 | //if ($field instanceof \Riclep\StoryblokForms\Blocks\LsfRadioButton) { |
||
| 24 | if (!array_key_exists($field->name, $repeatedFields)) { |
||
| 25 | $repeatedFields[$field->name] = null; |
||
| 26 | } |
||
| 27 | //} |
||
| 28 | |||
| 29 | return $field->response($repeatedFields[$field->name]); |
||
| 30 | })->toArray(); |
||
| 31 | })->toArray(), |
||
| 32 | 'type' => $this->type, |
||
| 33 | ]; |
||
| 35 | } |