Ejemplo n.º 1
0
 /**
  * getForm
  *
  * @param string|FieldDefinitionInterface $definition
  * @param string                          $control
  * @param bool|mixed                      $loadData
  *
  * @return Form
  */
 public function getForm($definition = null, $control = null, $loadData = false)
 {
     $form = new Form($control);
     if (is_string($definition)) {
         $definition = $this->getFieldDefinition($definition);
     }
     $form->defineFormFields($definition);
     if ($loadData === true) {
         $form->bind($this->getFormDefaultData());
     } elseif ($loadData) {
         $form->bind($loadData);
     }
     $renderer = $this->get('field.renderer', $this->formRenderer);
     if (class_exists($renderer)) {
         $form->setRenderer(new $renderer());
     }
     Ioc::getDispatcher()->triggerEvent('onModelAfterGetForm', array('form' => $form, 'model' => $this, 'control' => $control, 'definition' => $definition));
     return $form;
 }