Generates a drop down list.
@param string $name the input name.
@param string $select the selected value.
@param array $data data for generating the list options (value=>display).
@param array $htmlOptions
@return string the generated drop down list.
426474
public static function dropDownList($name, $select, $data, $htmlOptions = array())
    {
        $displaySize = TbArray::popValue('displaySize', $htmlOptions);

        // In case we do need to create a div container for the input element (i.e. has addon or defined col)
        $containerOptions = array();

        // Get the intended input width before the rest of the options are normalized
        self::addSpanClass($htmlOptions);
        self::addColClass($htmlOptions);
        $col = self::popColClasses($htmlOptions);

        $htmlOptions = self::normalizeInputOptions($htmlOptions);
        self::addCssClass('form-control', $htmlOptions);
        if (!empty($displaySize)) {
            $htmlOptions['size'] = $displaySize;
        }

        if (!empty($col)) {
            self::addCssClass($col, $containerOptions);
        }

        $output = '';

        if (!empty($containerOptions)) {
            $output .= self::openTag('div', $containerOptions);
        }
        $output .= parent::dropDownList($name, $select, $data, $htmlOptions);

        if (!empty($containerOptions)) {
            $output .= '</div>';
        }

        return $output;
    }
1064667
public function toOptions($name)
    {
        $html = '';
        foreach ($this->wei->getConfig($name) as $value => $text) {
            if (is_array($text)) {
                $html .= '<optgroup label="' . $value . '">';
                foreach ($text as $v => $t) {
                    $html .= '<option value="' . $v . '">' . $t . '</option>';
                }
                $html .= '</optgroup>';
            } else {
                $html .= '<option value="' . $value . '">' . $text . '</option>';
            }
        }
        return $html;
    }
915181
public function radios($name, $radioOptions, $options = [])
    {
        $requiredClass = (isset($options['required']) && $options['required'] == true) ? 'required ' : '';
        $hasError = $this->errorBag->has($this->formatArrayName($name));
        $hasErrorClass = $hasError ? 'has-error' : '';

        $htmlForm = '<div class="form-group '.$requiredClass.$hasErrorClass.'">';
        $htmlForm .= $this->setFormFieldLabel($name, $options);
        $htmlForm .= '<div>';

        foreach ($radioOptions as $key => $option) {
            $value = null;
            $fieldParams = ['id' => $name.'_'.$key, 'class' => 'form-check-input'];

            if (isset($options['value']) && $options['value'] == $key) {
                $value = true;
            }
            if (isset($options['v-model'])) {
                $fieldParams += ['v-model' => $options['v-model']];
            }
            if (isset($options['required']) && $options['required'] == true) {
                $fieldParams += ['required' => true];
            }
            if ($hasError) {
                $fieldParams['class'] .= ' is-invalid';
            }

            $listStyle = isset($options['list_style']) ? $options['list_style'] : 'form-check-inline';
            $htmlForm .= '<div class="form-check '.$listStyle.'">';
            $htmlForm .= FormFacade::radio($name, $key, $value, $fieldParams);
            $htmlForm .= '<label for="'.$name.'_'.$key.'" class="form-check-label">'.$option.'</label>';
            $htmlForm .= '</div>';
        }
        $htmlForm .= '</div>';

        $htmlForm .= $this->getInfoTextLine($options);

        $htmlForm .= $this->errorBag->first($this->formatArrayName($name), '<span class="small text-danger" role="alert">:message</span>');

        $htmlForm .= '</div>';

        return $htmlForm;
    }
512628
public function tag($name, $content, $htmlOptions = array()) {
        $element = "<$name ";
        foreach ($htmlOptions as $k => $v) {
            $element .= "$k=\"" . self::encode($v) . "\" ";
        }
        return $element . '>' . $content . '</' . $name . '>';
    }
696326
public static function checkBox($name, $checked = false, $htmlOptions = array())
    {
        $label = TbArray::popValue('label', $htmlOptions, false);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
        self::addCssClass('checkbox', $labelOptions);
        $input = parent::checkBox($name, $checked, $htmlOptions);
        return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
    }
73797
public function plainSelect($name, $list = array(), $selected = null, $options = array())
    {
        return parent::select($name, $list, $selected, $options);
    }
1374742
public static function selectTree(Collection $data, $selected = 0, $options = [], $htmlOptions = [])
    {
        $options = array_merge($options instanceof Std ? $options->toArray() : $options, ['tree']);
        if (empty($options['treeLevelColumn']))
            $options['treeLevelColumn'] = '__lvl';
        return self::select($data, $selected, $options, $htmlOptions);
    }
1227674
public function select($name, $list = [], $selected = null, array $selectAttributes = [], array $optionsAttributes = [], array $optgroupsAttributes = [])
    {
        $selectAttributes = $this->appendClassToOptions('form-control', $selectAttributes);

        if ($this->hasErrors($name)) {
            $selectAttributes = $this->appendClassToOptions('is-invalid', $selectAttributes);
        }

        return parent::select($name, $list, $selected, $selectAttributes, $optionsAttributes, $optgroupsAttributes);
    }
668804
public function addMultipleSelect(string $name) : Element\Select\MultipleSelect
    {
        $select = new Element\Select\MultipleSelect($this, $name . '[]');
        $this->addComponent($name, $select);

        return $select;
    }
779056
public function option($name, $option = NULL, $fields = [])
	{
		return $name ? $this->get($name)->option($option, $fields) : NULL;
	}
288555
function(name, optionData, multipleSelect) {
    const optionInputType = {
      selected: multipleSelect ? 'checkbox' : 'radio',
    }
    const optionDataOrder = ['value', 'label', 'selected']
    const optionInputs = []
    const optionTemplate = { selected: false, label: '', value: '' }

    optionData = Object.assign(optionTemplate, optionData)

    for (let i = optionDataOrder.length - 1; i >= 0; i--) {
      const prop = optionDataOrder[i]
      if (optionData.hasOwnProperty(prop)) {
        const attrs = {
          type: optionInputType[prop] || 'text',
          className: 'option-' + prop,
          value: optionData[prop],
          name: name + '-option',
        }

        attrs.placeholder = mi18n.get(`placeholder.${prop}`) || ''

        if (prop === 'selected' && optionData.selected === true) {
          attrs.checked = optionData.selected
        }

        optionInputs.push(m('input', null, attrs))
      }
    }

    const removeAttrs = {
      className: 'remove btn icon-cancel',
      title: mi18n.get('removeMessage'),
    }
    optionInputs.push(m('a', null, removeAttrs))

    return m('li', optionInputs).outerHTML
  }
635507
public static function selecty($options, $selected = null, $attribs = array())
    {
        $htmls = array();
        $htmls[] = self::select(null, $attribs, false);
        if (Arr::iterable($options)) {
            foreach ($options as $value => $title) {
                $option_attribs = array('value'=>$value);
                if ((string) $selected === (string) $value) {
                    $option_attribs['selected'] = 'selected';
                }
                
                $htmls[] = self::option($title, $option_attribs);
            }
        }
        $htmls[] = '</select>';
        return join("\n", $htmls);
    }
862460
protected function createChoice($data, $name, $activeName, $bucket, $urlParameters = null)
    {
        $active = $this->isChoiceActive($bucket['key'], $data, $activeName);

        if (empty($urlParameters)) {
            $urlParameters = $this->getOptionUrlParameters($bucket['key'], $name, $data, $active);
        }

        $choice = new ViewData\ChoiceAwareViewData();
        $choice->setLabel($bucket['key']);
        $choice->setCount($bucket['doc_count']);
        $choice->setActive($active);
        $choice->setUrlParameters($urlParameters);

        return $choice;
    }
369119
public static function select($name, $options, $attributes = array())
    {
        // Extract the value
        $value = isset($attributes['value']) ? $attributes['value'] : null;
        unset($attributes['value']);

        // Set the name
        $attributes['name'] = $name;

        // Set the id to the name if one
        // is not already set.
        if (!isset($attributes['id'])) {
            $attributes['id'] = $name;
        }

        // Opening tag
        $select = array();
        $select[] = "<select " . HTML::buildAttributes($attributes) . ">";

        // Options
        foreach ($options as $index => $option) {
            if (!is_numeric($index)) {
                $select[] = '<optgroup label="' . $index . '">';
                foreach ($option as $opt) {
                    $select[] = static::selectOption($opt, $value);
                }
                $select[] = '</optgroup>';
            } else {
                $select[] = static::selectOption($option, $value);
            }
        }

        // Closing tags
        $select[] = '</select>';

        return implode(PHP_EOL, $select);
    }
366530
public static function checkboxList($name, $selection = null, $items = [], $options = [])
    {
        if (!isset($options['item'])) {
            $itemOptions = ArrayHelper::remove($options, 'itemOptions', []);
            $encode = ArrayHelper::getValue($options, 'encode', true);
            $options['item'] = function ($index, $label, $name, $checked, $value) use ($itemOptions, $encode) {
                $options = array_merge([
                    'label' => $encode ? static::encode($label) : $label,
                    'value' => $value
                ], $itemOptions);
                return '<div class="checkbox">' . Html::checkbox($name, $checked, $options) . '</div>';
            };
        }

        return parent::checkboxList($name, $selection, $items, $options);
    }
1157476
public function select($name, $list = array(), $selected = null, $options = [])
    {
        $this->addErrorClass($name, $options);
        $tags['input'] = parent::select($name, $list, $selected, $options);
        $tags['error'] = $this->getErrorTag($name);
        return $this->buildTags($tags);
    }
378949
public function dropdown($name, $options = [], $atributes = null)
    {
        $ret = '<select name="'.$name.'" '.(($attributes !== null) ? $this->attributes($attributes) : "").'>';
        foreach ($variable as $key => $value) {
            if (is_array($value)) {
                $ret .= '<option value="'.$key.'" '.((isset($value["attributes"])) ? $this->atributes($value["attributes"]) : "").'>'.$this->getValue($key, $value["value"]).'</option>';
            } else {
                $ret .= '<option value="'.$key.'">'.$this->getValue($key, $value).'</option>';
            }
        }
        $ret .= "</select>";
        return $ret;
    }