Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function __construct($options)
 {
     if (!isset($options['validator'])) {
         $this->setValidator(new TextValidator());
     }
     if (isset($options['value'])) {
         $this->data = $options['value'];
         unset($options['value']);
     }
     parent::__construct($options);
 }
Exemplo n.º 2
0
 /**
  * Add form field
  *
  * @param FormField $field
  */
 public function addField(FormField $field)
 {
     $this->fields[] = $field;
     if ($field->getName() == null) {
         $field->setName('name_' . count($this->fields));
     }
     if ($field->getId() == null) {
         $field->setId('id_' . count($this->fields));
     }
     if ($field instanceof FileField) {
         $this->formTags['enctype'] = 'multipart/form-data';
     }
 }