Example #1
0
 public function __construct(array $elementData)
 {
     parent::__construct($elementData);
     $this->setRowName(isset($elementData['row']) ? $elementData['row'] : $this->getName() . 'Row');
     $this->fieldsetName = $this->extractValue($elementData, 'fieldset');
     $this->helpText = $this->extractValue($elementData, 'help');
     $this->labelTemplate = $this->extractValue($elementData, 'labelTemplate', static::DEFAULT_TEMPLATE_ELEMENT_LABEL);
     $this->inputTemplate = $this->extractValue($elementData, 'inputTemplate', static::DEFAULT_TEMPLATE_ELEMENT_INPUT);
     $this->helpTemplate = $this->extractValue($elementData, 'helpTemplate', static::DEFAULT_TEMPLATE_ELEMENT_HELP);
     $this->errorTemplate = $this->extractValue($elementData, 'errorTemplate', static::DEFAULT_TEMPLATE_ELEMENT_ERROR);
     $this->ngModel = $this->extractValue($elementData, 'ngModel');
 }
Example #2
0
 public function __construct(FormInterface $form, EntityToForm $e2f)
 {
     $data = $form->getOption(self::AUTORENDER);
     if (empty($data)) {
         $data = array();
     }
     parent::__construct($data);
     $this->ngModel = $this->extractValue($data, 'ngModel');
     $this->hasDenotesText = $this->extractValue($data, 'suppressDenotesText') ? false : true;
     $this->setZendFormElement($form);
     // add explicitly defined fieldsets
     if (isset($data['fieldsets'])) {
         foreach ($data['fieldsets'] as $fieldsetData) {
             $this->addFieldSet(new FieldSet($fieldsetData));
         }
     }
     // set default fieldset if no fieldsets were defined
     if (empty($this->children)) {
         $this->addFieldSet(new FieldSet(array()));
     }
     $rows = array();
     // add rows
     if (isset($data['rows'])) {
         foreach ($data['rows'] as $rowData) {
             $this->addRow(new Row($rowData));
         }
     }
     /* @var $formElement ElementInterface */
     foreach ($form->getElements() as $formElement) {
         $data = $formElement->getOption(self::AUTORENDER);
         if (!is_array($data)) {
             continue;
         }
         $field = Field::create($data, $formElement, $this, $e2f);
         $this->addField($field);
     }
 }
Example #3
0
 public function removeChild(Element $child)
 {
     return $this->remove($child->getName());
 }