/**
  * @return mixed|void
  */
 protected function createChildren()
 {
     $this->form = $this->getClassFromOptions();
     if ($this->form->getFormOption('files')) {
         $this->parent->setFormOption('files', true);
     }
     $model = $this->getOption($this->valueProperty);
     if ($model !== null) {
         foreach ($this->form->getFields() as $name => $field) {
             $field->setValue($this->getModelValueAttribute($model, $name));
         }
     }
     $this->children = $this->form->getFields();
 }
Example #2
0
 /**
  * It's the Laravel-From-Builder hack to fix error borders on all fields with the same name.
  *
  * @param Form $form
  * @param string $errorClass
  */
 function fixFormBuilderForm(Form $form, $errorClass)
 {
     foreach ($form->getFields() as $field) {
         $class = str_replace($errorClass, '', $field->getOption('wrapper.class'));
         $field->setOption('wrapper.class', $class);
     }
 }