Ejemplo n.º 1
0
 /**
  * @param Field|SelectField $field
  * @param array             $options
  *
  * @return string
  */
 public function __invoke($field, array $options = [])
 {
     $options = array_merge(["id" => $field->id], $options);
     $options['name'] = $field->name;
     if ($this->multiple) {
         $options['multiple'] = true;
     }
     $html = sprintf("<select %s>", html_params($options));
     foreach ($field->getChoices() as list($value, $label, $selected)) {
         $html .= self::renderOption($value, $label, $selected);
     }
     $html .= "</select>";
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function __construct(array $options = ['choices' => []])
 {
     $options = array_merge(["widget" => new ListWidget("ul", false), "option_widget" => new RadioInput()], $options);
     parent::__construct($options);
 }
Ejemplo n.º 3
0
 public function __construct(array $options = ['choices' => []])
 {
     $options = array_merge(["widget" => new Select()], $options);
     parent::__construct($options);
     $this->widget->multiple = true;
 }