public function addField(Field $field) { // find the row to which this belongs $rowName = $field->getRowName(); /* @var $row \FzyForm\Annotation\Row */ if (isset($this->rowToFieldset[$rowName])) { $fieldset = $this->getChild($this->rowToFieldset[$rowName]); $row = $fieldset->getChild($rowName); } else { $row = new Row(array('name' => $rowName, 'fieldset' => $field->getFieldsetName())); $this->addRow($row); } $row->addChild($field); $field->onAddedTo($row); return $this; }
public static function create(array $elementData, ElementInterface $element, AnnotatedForm $form, EntityToForm $e2f) { $type = isset($elementData['type']) ? $elementData['type'] : ''; if (empty($type)) { // inferr type from ZF2 Form Element type $clsName = get_class($element); $parts = explode('\\', $clsName); $type = end($parts); } switch (strtolower(trim($type))) { case 'subform': $annotation = new Subform($elementData); // do not 'setZendFormElement' because this element is replaced by the subform $annotation->populateFromParent($form, $e2f); break; case 'select': $annotation = new Select($elementData); $annotation->setZendFormElement($element); break; case 'checkbox': $annotation = new Checkbox($elementData); $annotation->setZendFormElement($element); break; case 'multicheckbox': // MultiCheckbox isn't fully implemented at this time, this is just a stub $annotation = new MultiCheckbox($elementData); $annotation->setZendFormElement($element); break; case 'radio': $annotation = new Radio($elementData); $annotation->setZendFormElement($element); break; case 'wysiwyg': $annotation = new Wysiwyg($elementData); $annotation->setZendFormElement($element); break; default: $annotation = new Field($elementData); $annotation->setZendFormElement($element); } $annotation->setParentForm($form); return $annotation; }
public function setZendFormElement(ElementInterface $element) { $element->setAttribute('data-ui-select2', $this->selectOptions); return parent::setZendFormElement($element); }
public function __construct(array $elementData) { parent::__construct($elementData); $this->getter = $this->extractValue($elementData, 'getter', null); }