示例#1
0
 /**
  * Add a FormField to the form's fields
  *
  * @param FormField $field
  * @return $this
  */
 protected function addField(FormField $field, $modify = false)
 {
     if (!$modify && !$this->rebuilding) {
         $this->preventDuplicate($field->getRealName());
     }
     $this->fields[$field->getRealName()] = $field;
     return $this;
 }
示例#2
0
 /**
  * Add a FormField to the form's fields
  *
  * @param FormField $field
  * @return $this
  */
 protected function addField(FormField $field, $modify = false)
 {
     if (!$modify && !$this->rebuilding) {
         $this->preventDuplicate($field->getRealName());
     }
     if ($field->getType() == 'file') {
         $this->formOptions['files'] = true;
     }
     $this->fields[$field->getRealName()] = $field;
     return $this;
 }
 /**
  * Prepare collection for prototype by adding prototype as child
  * @param FormField $field
  */
 public function preparePrototype(FormField $field)
 {
     if (!$field->getOption('is_prototype')) {
         throw new \InvalidArgumentException('Field [' . $field->getRealName() . '] is not a valid prototype object.');
     }
     $this->children = [];
     $this->children[] = $field;
 }