/** * @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; }
/** * @inheritdoc */ public function __construct(array $options = ['choices' => []]) { $options = array_merge(["widget" => new ListWidget("ul", false), "option_widget" => new RadioInput()], $options); parent::__construct($options); }
public function __construct(array $options = ['choices' => []]) { $options = array_merge(["widget" => new Select()], $options); parent::__construct($options); $this->widget->multiple = true; }