TbHtml::btnDropdown PHP Method

btnDropdown() protected static method

Generates a button dropdown.
protected static btnDropdown ( string $type, string $label, array $items, array $htmlOptions ) : string
$type string the button type.
$label string the button label text.
$items array the menu items.
$htmlOptions array additional HTML attributes.
return string the generated button.
    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;
    }
TbHtml