Build the dropdown element.

@return Div
499601
public function make()
    {
        $menuClasses = ['dropdown-menu'];

        if ($this->right) {
            $menuClasses[] = 'dropdown-menu-right';
        }

        return new Div(['class' => 'dropdown'], [
            new Anchor(
                [
                    'id' => $this->hash,
                    'data-toggle' => 'dropdown',
                    'aria-haspopup' => 'true',
                    'aria-expanded' => 'false',
                ],
                new Italic(['class' => 'fa fa-ellipsis-h'])
            ),
            new Div(
                [
                    'class' => $menuClasses,
                    'aria-labelledby' => $this->hash,
                ],
                $this->options
            ),
        ]);
    }
926984
public function build()
    {
        if (empty($this->groups)) {
            Throw new FormDesignerException('Your form has no groups to show. Add groups and try again.');
        }

        if (!$this->html->getId()) {
            Throw new FormDesignerException('There is no unique form id set. Each FormDesigner form needs it\'s unique id');
        }

        // Handle global container errors
        $this->handleGlobalContainerErrors();

        // Handle display mode
        $this->handleDisplayMode();

        // Control html container
        $html = '';

        // Create hidden field with unique session token
        if (!empty($this->token)) {
            $html .= '<input type="hidden" name="' . $this->token['name'] . '" value="' . $this->token['token'] . '">';
        }

        foreach ($this->groups as $group) {
            $html .= $this->buildGroup($group, [], $this->data, $this->errors);
        }

        $this->html->addInner($html);

        return $this->html->build();
    }
417802
public function build()
    {
        // first step is to set the icon name itself
        $this->css[] = 'fa-' . $this->icon;

        if (isset($this->on)) {
            $stack = $this->factory->create('Elements\Span');
            $stack->addCss('fa fa-stack');
            $this->addCss('fa-stack-1x');

            // Create the on icon
            $on = $this->factory->create('Fontawesome\Icon');
            $on->useIcon($this->on);
            $on->addCss([
                'fa-stack-2x',
                'icon_bg'
            ]);
            $icon_1 = $on->build();
        }

        // size set for icon?
        if (isset($this->size)) {

            if (isset($stack)) {
                $stack->addCss('fa-' . $this->size);
            }
            else {
                $this->addCss('fa-' . $this->size);
            }
        }

        // any floating wanted?
        if (isset($this->pull)) {

            if (isset($stack)) {
                $stack->addCss('fa-pull-' . $this->pull);
            }
            else {
                $this->addCss('fa-pull-' . $this->pull);
            }
        }

        // draw border?
        if ($this->border && !isset($stack)) {
            $this->css[] = 'fa-border';
        }

        // is muted?
        if ($this->muted) {

            if (isset($stack)) {
                $stack->addCss('fa-muted');
            }
            else {
                $this->css[] = 'fa-muted';
            }
        }

        // flip icon?
        if (isset($this->flip)) {

            if (isset($stack)) {
                $stack->addCss('fa-flip-' . $this->flip);
            }
            else {
                $this->css[] = 'fa-flip-' . $this->flip;
            }
        }

        // rotate icon?
        if (isset($this->rotation)) {
            if (isset($stack)) {
                $stack->addCss('fa-rotate-' . $this->rotation);
            }
            else {
                $this->css[] = 'fa-rotate-' . $this->rotation;
            }
        }

        // spin icon?
        if ($this->spin) {
            if (isset($stack)) {
                $stack->addCss('fa-spin');
            }
            else {
                $this->css[] = 'fa-spin';
            }
        }

        $icon_2 = parent::build();

        if (isset($stack)) {
            $stack->setInner($icon_1 . PHP_EOL . $icon_2);
            $html = $stack->build();
        }
        else {
            $html = $icon_2;
        }

        return $html;
    }
781648
public function build()
    {
        parent::build();

        $value = $this->validator->arrayGet($this->suppliedOptions, 'value', true);

        //we need to set the value to 'false' when it is falsey so it plays nicely with select2
        if (!$value && $value !== '') {
            $this->suppliedOptions['value'] = 'false';
        }
    }
520524
protected function buildSelect()
    {
        if (!empty($this->props['attribs']['multiple']) && \substr($this->props['attribs']['name'], -2) !== '[]') {
            $this->props['attribs']['name'] .= '[]';
        }
        if ($this->props['attribs']['required'] && !$this->props['attribs']['multiple'] && $this->props['options']) {
            /*
                Check for an empty-value "Select" option
                If no empty option, add one
            */
            $firstValue = $this->props['options'][0]['attribs']['value'];
            $emptyValues = array('','--','select');
            if (!\in_array(\strtolower($firstValue), $emptyValues)) {
                $selectOption = array(
                    'attribs' => array(
                        'value' => '',
                        'disabled' => true,
                        'selected' => empty($this->props['values']),
                    ),
                    'label' => 'Select',
                );
                \array_unshift($this->props['options'], $selectOption);
            }
        }
        // build select input
        $this->props['attribs']['type'] = null;
        $attribStrings = $this->buildAttribStrings($this->props);
        $props = \array_merge($this->props, $attribStrings);
        if (empty($props['input'])) {
            $this->props['input'] = Html::buildTag(
                $props['tagname'],
                $props['attribs'],
                "\n".$this->buildSelectOptions($this->props['options'], $this->props['values'])
            );
            $props['input'] = $this->buildInputGroup();
        }
        return $this->props['tagOnly']
            ? $props['input']
            : Str::quickTemp($props['template'], $props);
    }
1007343
public function html(): Builder
    {
        /** @var Builder $table */
        $table = app('datatables.html');

        return $table
            ->columns($this->getColumns())
            ->ajax($this->getAjaxOptions())
            ->parameters($this->getParameters());
    }
991251
protected function getOptions()
	{
		// Initialize variables.
		$options = array();

		if ($this->element['option_blank'])
		{
			$options[] = Dropdown::option('', App::get('language')->txt('- Select -'), 'value', 'text');
		}

		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			$label = (isset($option[0]) ? $option[0] : $option['label']);

			// Create a new option object based on the <option /> element.
			$tmp = Dropdown::option((string) $option['value'],
				App::get('language')->alt(trim((string) $label), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text',
				((string) $option['disabled'] == 'true')
			);
			foreach ($option->attributes() as $index => $value)
			{
				$dataCheck = strtolower(substr($index, 0, 4));
				if ($dataCheck == 'data')
				{
					$tmp->$index = (string) $value;
				}
			}

			// Set some option attributes.
			$tmp->class = (string) $option['class'];

			// Set some JavaScript option attributes.
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}
715100
protected function SaveElement()
    {
        $this->submit->SetName($this->Value('Name'));
        $this->submit->SetValue($this->Value('Value'));
        return $this->submit;
    }
1050670
public function build()
    {
        foreach ($this->child as $element) {
            $element->build();
            $this->node->appendChild($element->getNode());
        }

        return $this;
    }
824200
public function build()
    {
        if(($document = $this->getDocument()) === null) {
            $document = $this->loader->getInstance(NodeLoader::DOCUMENT_NODE);
            $this->setDocument($document);
        }

        if(($header = $document->getHeader()) === null) {
            $header = $this->loader->getInstance(NodeLoader::HEADER_NODE);
            $document->setHeader($header);
        }

        if(($supplier = $header->getSupplier()) === null) {
            $supplier = $this->loader->getInstance(NodeLoader::SUPPLIER_NODE);
            $header->setSupplier($supplier);
        }

        if(($catalog = $header->getCatalog()) === null) {
            $catalog = $this->loader->getInstance(NodeLoader::CATALOG_NODE);
            $header->setCatalog($catalog);
        }

        if(($datetime = $catalog->getDateTime()) === null) {
            $datetime = $this->loader->getInstance(NodeLoader::DATE_TIME_NODE);
            $catalog->setDateTime($datetime);
        }

        if(($newCatalog = $document->getNewCatalog()) === null) {
            $newCatalog = $this->loader->getInstance(NodeLoader::NEW_CATALOG_NODE);
            $document->setNewCatalog($newCatalog);
        }

        return $document;
    }
1329850
public function run()
    {
        // @todo use [[options]] instead of [[containerOptions]] and introduce [[buttonOptions]] before 2.1 release
        Html::addCssClass($this->containerOptions, ['widget' => 'btn-group']);
        $options = $this->containerOptions;
        $tag = ArrayHelper::remove($options, 'tag', 'div');

        $this->registerPlugin('dropdown');
        return implode("\n", [
            Html::beginTag($tag, $options),
            $this->renderButton(),
            $this->renderDropdown(),
            Html::endTag($tag)
        ]);
    }
658438
private function build() {

        //Get value
        $selected = null;

        if(true === $this -> filled) {

            if(true === isset($this -> attributes['name'])) {

                if(true === Request :: isPost()) {
                    $selected = Request :: fromPost($this -> attributes['name']);
                }
            }
        }

        //Build select
        $html = '<select';
        
        foreach($this -> attributes as $attribute => $value) {

            if('value' !== $attribute) {
                $html .= ' ' . $attribute . '="'. Escape :: attr($value) .'"';
            }
        }

        $html .= '>';

        //Build options
        foreach($this -> options as $key => $value) {

            if(true === is_array($value)) {

                $html .= '<optgroup label="'. Escape :: attr($key) .'">';

                    foreach($value as $key => $value) {

                        $html .= '<option value="'. Escape :: attr($key) .'"';

                            if($key === $selected) {
                                $html .= ' selected="selected"';
                            }

                        $html .= '>'. Escape :: html($value) .'</option>';
                    }

                $html .= '</optgroup>';
            }
            else {

                $html .= '<option value="'. Escape :: attr($key) .'"';

                    if($key === $selected) {
                        $html .= ' selected="selected"';
                    }

                $html .= '>'. Escape :: html($value) .'</option>';
            }
        }
        
        $html .= '</select>';

        return $html;
    }
577741
private function buildSelect($ele){

        $formNs = $this->formNs;

        $html = '<div class="'.$formNs.'form-group">';
        if ($ele['title']){
            $html .= '<label class="'.$formNs.'form-label" for="'.$ele['id'].'">'.$ele['title'].'</label>';
        }
        $html .= '<div class="'.$formNs.'form-content">';
        $html .= '<select name="'.$ele['name'].'" id="'.$ele['id'].'" class="'.$formNs.'form-textarea textarea-'.$ele['name'].'" ';
        if (isset($ele['required'])){
            $html .= ' required="" ';
        }
        if (isset($ele['readonly'])){
            $html .= ' readonly="" ';
        }

        $html .= '>';

        foreach ($ele['extra'] as $k=>$v){
            if ($ele['value'] == $k){
                $html .= '<option value="'.$k.'" selected="" >'.$v.'</option>';
            }else {
                $html .= '<option value="'.$k.'" >'.$v.'</option>';
            }
        }

        $html .= '</select>';
        if ($ele['msg']){
            $html .= '<p class="'.$formNs.'form-help">'.$ele['msg'].'</p>';
        }
        $html .= '</div>';
        $html .= '</div>';

        return $html;
    }
1264823
function() {

            // Build ul.
            this.$ul = $(this.options.templates.ul);

            if (this.options.dropRight) {
                this.$ul.addClass('pull-right');
            }

            // Set max height of dropdown menu to activate auto scrollbar.
            if (this.options.maxHeight) {
                // TODO: Add a class for this option to move the css declarations.
                this.$ul.css({
                    'max-height': this.options.maxHeight + 'px',
                    'overflow-y': 'auto',
                    'overflow-x': 'hidden'
                });
            }

            this.$container.append(this.$ul);
        }
866184
public static function dom(){
        $attr = self::$attr;
//        $attr['param'] = self::strToArray($attr['param']);
//        p($attr['param']);

        $label = explode('|',$attr['label']);
        $linkfield = explode('|',$attr['linkfield']);

        $str = '';
        foreach($label as $k => $v){

            $str .= <<<EOT
    <label class="layui-form-label">{$v}</label>
    <div class="layui-input-inline">
        <select name="{$linkfield[$k]}" lay-verify="{$attr['layVerify']}" >
            <option value="">请选择</option>
        </select>
    </div>
EOT;

        }

        $dom = <<<EOT
            <div class="layui-form-item {$attr['component_name']}" component-name="linkselect" id="{$attr['id']}">
                    {$str}
                    <div class="layui-form-mid layui-word-aux">{$attr['helpinfo']}</div>
                </div>
EOT;

        return $dom;
    }
304229
public function field()
    {
        $optionsCode = '';

        if (is_array($this->options['options'])) {
            foreach ($this->options['options'] as $key => $value) {
                $optionsCode .= '<option value="'.$key.'"'.($this->value == $key ?
                    ' selected="selected"' : null).'>'.
                    $value.'</option>';
            }
        } elseif ($optionClass = $this->options['options']) {
            $options = $optionClass::orderBy((isset($this->options['optionsSort']) ? $this->options['optionsSort'] : 'id'),
                                              (isset($this->options['optionsSortOrder']) ? $this->options['optionsSortOrder'] : 'asc'))->get();

            foreach ($options as $option) {
                $optionValue = isset($this->options['optionsValue']) ? $this->options['optionsValue'] : 'id';
                $optionShow = isset($this->options['optionsShow']) ? $this->options['optionsShow'] : 'name';

                $optionsCode .= '<option value="'.$option->$optionValue.'"'.($this->value == $option->$optionValue ?
                    ' selected="selected"' : null).'>'.
                    $option->$optionShow.'</option>';
            }
        }

        $input = new HTMLBrick('select', $optionsCode, [
            'id'   => $this->id,
            'name' => $this->name,
        ]);
        $input->addClass('form-control');

        return $input;
    }
386763
public function render()
	{
		$element = $this->elementPrototype;
		/** @var BootstrapRenderer $renderer */
		$renderer = $this->row->getParent()->form->renderer;

		$element = $renderer->configElem(RendererConfig::gridCell, $element);
		$element->class[] = $this->createClass();

		if ($this->childControl) {
			$pairHtml = $renderer->renderPair($this->childControl);
			$element->addHtml($pairHtml);
		}

		return $element;
	}