PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Shortcode / ShortcodeFieldCollector.php

ShortcodeFieldCollector.php in The Innovative Form Builder – IvyForms 1.5, at backend/src/Services/Shortcode/ShortcodeFieldCollector.php

40 lines 940 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @copyright © Melograno Venture Studio. All rights reserved.
5 * @licence See LICENCE.md for license details.
6 */
7
8 namespace IvyForms\Services\Shortcode;
9
10 use IvyForms\Common\Exceptions\ValidationException;
11 use IvyForms\Factory\Field\FieldFactory;
12
13 /**
14 * Collects field entities from shortcode form payloads, skipping invalid fields.
15 */
16 class ShortcodeFieldCollector
17 {
18 /**
19 * @param array<string, array<string, mixed>> $formList
20 *
21 * @return array<object>
22 */
23 public static function collect(array $formList): array
24 {
25 $allFields = [];
26
27 foreach ($formList as $formData) {
28 foreach ($formData['fields'] as $fieldData) {
29 try {
30 $allFields[] = FieldFactory::create($fieldData);
31 } catch (ValidationException $e) {
32 continue;
33 }
34 }
35 }
36
37 return $allFields;
38 }
39 }
40