Generates a button dropdown.
@param string $type the button type.
@param string $label the button label text.
@param array $items the menu items.
@param array $htmlOptions additional HTML attributes.
@return string the generated button.
760373
protected static function btnDropdown($type, $label, $items, $htmlOptions)
    {
        $menuOptions = TbArray::popValue('menuOptions', $htmlOptions, array());
        $groupOptions = TbArray::popValue('groupOptions', $htmlOptions, array());
        self::addCssClass('btn-group', $groupOptions);
        if (TbArray::popValue('dropup', $htmlOptions, false)) {
            self::addCssClass('dropup', $groupOptions);
        }
        $output = self::openTag('div', $groupOptions);
        $toggleButtonType = TbArray::popValue('type', $htmlOptions, self::BUTTON_TYPE_HTML);
        $toggleButtonType = is_array($toggleButtonType) ? $toggleButtonType[1] : $toggleButtonType;
        if (TbArray::popValue('split', $htmlOptions, false)) {
            $output .= self::createButton($type, $label, $htmlOptions);
            $label = '';
        }        
        if(in_array($toggleButtonType, array(self::BUTTON_TYPE_LINKBUTTON, self::BUTTON_TYPE_LINK))){
            $output .= self::dropdownToggleLink($label, $htmlOptions);       
        } else {
            $output .= self::dropdownToggleButton($label, $htmlOptions);
        }
        $output .= self::dropdown($items, $menuOptions);
        $output .= '</div>';
        return $output;
    }
697595
public function getColumnOrderLink($column, $label, $htmlOptions = array()) {
        return Html::get()->link($this->getColumnOrderURL($column), $label, $htmlOptions);
    }
456614
public function getLinkForPage($pageNumber, $label, $htmlOptions = array()) {
        return Html::get()->link($this->getURLForPage($pageNumber), $label, $htmlOptions);
    }
1236547
public static function nav($type, $items, $htmlOptions = array())
    {
        self::addCssClass('nav', $htmlOptions);
        if (!empty($type)) {
            self::addCssClass('nav-' . $type, $htmlOptions);
        }
        $stacked = TbArray::popValue('stacked', $htmlOptions, false);
        if ($type !== self::NAV_TYPE_LIST && $stacked) {
            self::addCssClass('nav-stacked', $htmlOptions);
        }
        return self::menu($items, $htmlOptions);
    }
352936
public function checkboxes($name, $label = null, $choices = [], $checkedValues = [], $inline = false, array $options = [])
    {
        $elements = '';

        foreach ($choices as $value => $choiceLabel) {
            $checked = in_array($value, (array) $checkedValues);

            $elements .= $this->checkboxElement($name, $choiceLabel, $value, $checked, $inline, $options);
        }

        $wrapperOptions = $this->isHorizontal() ? ['class' => $this->getRightColumnClass()] : [];
        $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $elements . $this->getFieldError($name) . $this->getHelpText($name, $options) . '</div>';

        return $this->getFormGroup($name, $label, $wrapperElement);
    }
1292586
public static function inlineList($items, $htmlOptions = array())
    {
        $listItems = array();
        Html::addCssClass($htmlOptions, 'inline-list');
        foreach ($items as $item) {
            $listItems[] = \CHtml::tag('li', $htmlOptions, $item);
        }

        if (!empty($listItems)) {
            return \CHtml::tag('ul', $htmlOptions, implode("\n", $listItems));
        }
    }
659256
protected function renderItems($items, $options = [])
    {
        $lines = [];
        foreach ($items as $item) {
            if (is_string($item)) {
                $lines[] = $item;
                continue;
            }
            if (isset($item['visible']) && !$item['visible']) {
                continue;
            }
            if (!array_key_exists('label', $item)) {
                throw new InvalidConfigException("The 'label' option is required.");
            }
            $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
            $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
            $itemOptions = ArrayHelper::getValue($item, 'options', []);
            $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
            $linkOptions['tabindex'] = '-1';
            $url = array_key_exists('url', $item) ? $item['url'] : null;
            if (empty($item['items'])) {
                if ($url === null) {
                    $content = $label;
                    Html::addCssClass($itemOptions, ['widget' => 'dropdown-header']);
                } else {
                    $content = Html::a($label, $url, $linkOptions);
                }
            } else {
                $submenuOptions = $this->submenuOptions;
                if (isset($item['submenuOptions'])) {
                    $submenuOptions = array_merge($submenuOptions, $item['submenuOptions']);
                }
                $content = Html::a($label, $url === null ? '#' : $url, $linkOptions)
                    . $this->renderItems($item['items'], $submenuOptions);
                Html::addCssClass($itemOptions, ['widget' => 'dropdown-submenu']);
            }

            $lines[] = Html::tag('li', $content, $itemOptions);
        }

        return Html::tag('ul', implode("\n", $lines), $options);
    }
196574
public function input($type, $name, $label = null, $value = null, array $options = [])
    {
        $label = $this->getLabelTitle($label, $name);

        $optionsField = $this->getFieldOptions(array_except($options, ['suffix', 'prefix']), $name);

        $inputElement = '';

         if(isset($options['prefix'])) {
            $inputElement = $options['prefix'];
        }

        $inputElement .= $type === 'password' ? $this->form->password($name, $optionsField) : $this->form->{$type}($name, $value, $optionsField);

         if(isset($options['suffix'])) {
            $inputElement .= $options['suffix'];
        }

         if(isset($options['prefix']) || isset($options['suffix'])) {
            $inputElement = '<div class="input-group">' . $inputElement . '</div>';
        }

        $wrapperOptions = $this->isHorizontal() ? ['class' => $this->getRightColumnClass()] : [];
        $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . $this->getHelpText($name, $optionsField) . '</div>';

        return $this->getFormGroup($name, $label, $wrapperElement);
    }
1264252
public static function splitButtonDropdown($label, $items, $htmlOptions = array())
    {
        $htmlOptions['split'] = true;
        return self::buttonDropdown($label, $items, $htmlOptions);
    }
267409
public function openGroup($name, $label = null, $options = array())
    {
        $options = $this->appendClassToOptions(Config::get('form-builder.group-class'), $options);

        $this->groupStack[] = $name;

        if ($this->hasErrors($name)) {
            $options = $this->appendClassToOptions(Config::get('form-builder.error-class'), $options);
        }

        $label = $label ? $this->label($name, $label) : '';

        return $this->toHtmlString('<div'.$this->html->attributes($options).'>'.$label);
    }
1140312
function(opts) {
			var i, n, options, label, self = this;
			opts = opts || {};
	
			if (self.tagType === TAG_SELECT) {
				options = [];
				for (i = 0, n = self.items.length; i < n; i++) {
					label = self.options[self.items[i]][self.settings.labelField] || '';
					options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
				}
				if (!options.length && !this.$input.attr('multiple')) {
					options.push('<option value="" selected="selected"></option>');
				}
				self.$input.html(options.join(''));
			} else {
				self.$input.val(self.getValue());
				self.$input.attr('value',self.$input.val());
			}
	
			if (self.isSetup) {
				if (!opts.silent) {
					self.trigger('change', self.$input.val());
				}
			}
		}
126602
protected static function dropdown($items, $htmlOptions = array())
    {
        TbArray::defaultValue('role', 'menu', $htmlOptions);
        self::addCssClass('dropdown-menu', $htmlOptions);
        return self::menu($items, $htmlOptions);
    }
1232943
public static function group($buttons, $htmlOptions = array())
    {
        ArrayHelper::addValue('class', 'button-group', $htmlOptions);

        ob_start();
        echo \CHtml::openTag('ul', $htmlOptions);
        foreach ($buttons as $button) {
            echo $button;
        }
        echo \CHtml::closeTag('ul');

        return ob_get_clean();
    }
388170
function btn($label, $tagbody) {
		return $this->button($label, null, $tagbody)
			->set('type', null);
	}
1229595
public function select($key, $label, FormOptions $options=null, array $attr=[]){
		if ( $options !== null ){
			$attr['options'] = $options;
		}
		$field = $this->factory('select', $key, $label, $attr);
		return $this->addField($field);
	}
843177
public function buttonGroup($actions, $type, $options=array())
	{
		return $this->ButtonGroup->build($actions, $type, $options);
	}
238423
public static function select(Collection $data, $selected = 0, $options = [], $htmlOptions = [])
    {
        if (empty($options['valueColumn']))
            $options['valueColumn'] = Model::PK;
        if (empty($options['titleColumn']))
            $options['titleColumn'] = 'title';
        if (is_array($selected))
            $selected = $selected[$options['valueColumn']];
        if ($selected instanceof Model) {
            $selected = $selected->{$options['valueColumn']};
        }
        if (empty($options['disabled']))
            $options['disabled'] = [];

        if ($options instanceof Std) {
            $options = $options->getData();
        }

        $htmlOptionsText = [];
        foreach ($htmlOptions as $key => $value) {
            if (is_numeric($key)) {
                $htmlOptionsText[] = $value;
            } else {
                $htmlOptionsText[] = $key . '="' . $value . '"';
            }
        }
        $htmlOptionsText = implode(' ', $htmlOptionsText);

        $html = '<select ' . $htmlOptionsText . '>' . "\n";
        if (
            isset($options['null']) && $options['null']
            &&
            $data->first()[$options['valueColumn']] !== 0 && $data->first()[$options['titleColumn']] !== '---'
        ) {
            $data->prepend([$options['valueColumn'] => 0, $options['titleColumn'] => '---']);
        }
        foreach ($data as $item) {
            $html .=
                '<option
                    value="' . $item[$options['valueColumn']] . '"' .
                ($item[$options['valueColumn']] == $selected ? ' selected="selected"' : '') .
                (in_array($item[$options['valueColumn']], $options['disabled']) ? ' disabled="disabled"' : '') .
                '>' .
                (
                    in_array('tree', $options) && isset($options['treeLevelColumn']) && isset($item[$options['treeLevelColumn']])
                        ? str_repeat(self::TREE_LEVEL_SYMBOL, (int)$item[$options['treeLevelColumn']])
                        : ''
                ) . ' ' .
                $item[$options['titleColumn']] .
                '</option>' . "\n";
        }
        $html .= '</select>';
        return $html;
    }