Generates a collapse element.
@param string $target the CSS selector for the target element.
@param array $htmlOptions additional HTML attributes.
@return string the generated icon.
504193
public static function navbarCollapseLink($target, $htmlOptions = array())
    {
        self::addCssClass('btn btn-navbar', $htmlOptions);
        $htmlOptions['data-toggle'] = 'collapse';
        $htmlOptions['data-target'] = $target;
        $content = '<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>';
        return self::tag('a', $htmlOptions, $content);
    }
471619
public static function icon($icon, $options = [])
    {
        Html::addCssClass($options, $icon . ' icon');
        return Html::tag(ArrayHelper::remove($options, 'tag', 'i'), '', $options);
    }
1110830
protected static function addTextAlignClass(&$htmlOptions)
    {
        $align = TbArray::popValue('textAlign', $htmlOptions);
        if (!empty($align)) {
            self::addCssClass('text-' . $align, $htmlOptions);
        }
    }
117514
protected function renderCollapseButton($options = [], $collapsed = false)
    {
        $options = array_replace_recursive([
            'class' => 'btn btn-box-tool',
            'data-widget' => 'collapse',
        ], $options);

        return Html::button($collapsed ? FA::i('plus') : FA::i('minus'), $options);
    }
740185
public static function options2html(array $options = [], $selectedValue = null){
        // buffer prepared html codes
        $buffer = [];
        // loop options
        foreach ($options as $key => $value) {
            // make optgroup
            if(is_array($value)){
                // turn optgroup options to html
                $optgroupOptions = static::options2html($value, $selectedValue);
                // append prepared group to buffer
                $buffer[] = "<optgroup label='$key'>$optgroupOptions</options>";
            } else {
            // make option
                // print selected='' if option value and selected value are equivalent
                $selected = static::selected($selectedValue, $value);
                // append prepared option to buffer
                $buffer[] = "<option value='$value' $selected>$key</option>";
            }
        }
        // make html
        $html = implode('', $buffer);
        // return result
        return $html;
    }
565664
public static function thumbnail($content, $htmlOptions = array())
    {
        $itemOptions = TbArray::popValue('itemOptions', $htmlOptions, array());
        self::addCssClass('thumbnail', $htmlOptions);
        $output = self::openTag('li', $itemOptions);
        $output .= self::tag('div', $htmlOptions, $content);
        $output .= '</li>';
        return $output;
    }
944571
public static function navbarCollapseLink($target, $htmlOptions = array())
    {
        self::addCssClass('btn btn-navbar', $htmlOptions);
        $htmlOptions['type'] = 'button';
        $htmlOptions['data-toggle'] = 'collapse';
        $htmlOptions['data-target'] = $target;
        self::addCssClass('navbar-toggle', $htmlOptions);
        $content = self::tag('span', array('class' => 'sr-only'), 'Toggle navigation');
        $content .= '<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>';
        return self::tag('button', $htmlOptions, $content);
    }
55832
protected static function dropdownToggle($type, $label, $htmlOptions)
    {
        self::addCssClass('dropdown-toggle', $htmlOptions);
        $label .= ' <b class="caret"></b>';
        $htmlOptions['data-toggle'] = 'dropdown';
        return self::btn($type, $label, $htmlOptions);
    }
1207091
protected function _createIcon(HtmlHelper $html, $title, array $options = [])
    {
        list($options, $iconOptions) = $this->_createIconAttr($options);

        if (Arr::key('createIcon', $iconOptions)) {
            unset($iconOptions['createIcon']);
            $title = $html->icon($options['icon'], $iconOptions) . PHP_EOL . $title;
            unset($options['icon']);
        }

        if (Arr::key('iconInline', $options)) {
            unset($options['iconInline']);
        }

        return [$title, $options];
    }
294474
private function _optionsHTML()
    {
        $result = '';
        foreach ($this->options() as $key => $label) {
            $selected = ResourceTable::getSearchValue($this->index()) == $key ? ' selected="selected"' : '';
            $result .= '<option value="'.$key.'"'.$selected.'>'.$label.'</option>';
        }
        return $result;
    }
30141
public static function addCssStyle($style, &$htmlOptions)
    {
        if (is_array($style)) {
            $style = implode('; ', $style);
        }
        $style = rtrim($style, ';');
        $htmlOptions['style'] = isset($htmlOptions['style'])
            ? rtrim($htmlOptions['style'], ';') . '; ' . $style
            : $style;
    }
434522
protected function options($target)
    {
        $options = JSON_ERROR_NONE;

        if (isset($this->options[$target]))
        {
            foreach ($this->options[$target] as $option)
            {
                $options |= $option;
            }
        }

        return $options;
    }
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();
    }
700956
protected static function getColClasses($htmlOptions)
    {
        // todo: why would you want to do this
        $colClasses = array();
        if (isset($htmlOptions['class']) && !empty($htmlOptions['class'])) {
            $classes = explode(' ', $htmlOptions['class']);
            foreach ($classes as $class) {
                if (substr($class, 0, 4) == 'col-') {
                    $colClasses[] = $class;
                }
            }
        }
        return implode(' ', array_unique($colClasses));
    }
722973
protected function htmlOptionsResult($value = '')
    {
        $class = !empty($this->defaults['resultClass']) ? $this->defaults['resultClass'] . $value : '';
        $style = !empty($this->defaults['resultStyle']) ? $this->defaults['resultStyle'] : '';

        if (!empty($this->bootstrapDefaults['resultClass'])) {
            $class .= $this->bootstrapDefaults['resultClass'];
        }
        if (!empty($this->bootstrapDefaults['resultStyle'])) {
            $style .= $this->bootstrapDefaults['resultStyle'];
        }
        if (!empty($this->resultClass) && is_string($this->resultClass)) {
            $class .= ' ' . $this->resultClass;
        }
        if (!empty($this->resultStyle) && is_string($this->resultStyle)) {
            $style .= ' ' . $this->resultStyle;
        }

        return [
            'class' => $class ?: null,
            'style' => $style ?: null,
        ];
    }
1065008
public static function controls($controls, $htmlOptions = array())
    {
        if (TbArray::popValue('row', $htmlOptions, false)) {
            self::addCssClass('row', $htmlOptions);
        }
        $before = TbArray::popValue('before', $htmlOptions, '');
        $after = TbArray::popValue('after', $htmlOptions, '');
        if (is_array($controls)) {
            $controls = implode('', $controls);
        }
        $content = $before . $controls . $after;
        return self::tag('div', $htmlOptions, $content);
    }
961671
public static function navbarForm($action, $method = 'post', $htmlOptions = array())
    {
        self::addCssClass('navbar-form', $htmlOptions);
        return self::form($action, $method, $htmlOptions);
    }