File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55use ipl \Html \Attributes ;
66
7+ /**
8+ * Collection can be used for creating dynamic forms or elements by describing a template which
9+ * will create as many iteration as provided in `populate()`.
10+ *
11+ * Example:
12+ * ```php
13+ * $collection = new Collection('testCollection');
14+ *
15+ * $collection->setAddElement('add_element', [
16+ * 'required' => false,
17+ * 'label' => 'Add Trigger',
18+ * 'options' => [null => 'Please choose', 'first' => 'First Option'],
19+ * 'class' => 'autosubmit'
20+ * ]);
21+ *
22+ * $collection->onAssembleGroup(function ($group, $addElement, $removeElement) {
23+ * $group->addElement($addElement);
24+ * $group->addElement('input', 'test_input');
25+ * });
26+ *
27+ * $form
28+ * ->registerElement($collection)
29+ * ->addHtml($collection)
30+ * ```
31+ */
732class Collection extends FieldsetElement
833{
934 protected const GROUP_CSS_CLASS = 'form-element-collection ' ;
You can’t perform that action at this time.
0 commit comments