/** * @param bool $bindValues should model value be bound to form * @return mixed|void */ protected function rebuild($bindValues = false) { $this->form = $this->getClassFromOptions(); $this->form->setFormOptions(array('name' => $this->name, 'is_child' => true))->rebuildFields(); $model = $this->getOption('default_value'); if ($bindValues && $model) { foreach ($this->form->getFields() as $name => $field) { $field->setValue($this->getModelValueAttribute($model, $name)); } } $this->children = $this->form->getFields(); }