public static function btn($type, $label, $htmlOptions = array())
{
self::addCssClass('btn', $htmlOptions);
$color = TbArray::popValue('color', $htmlOptions, self::BUTTON_COLOR_DEFAULT);
if (!empty($color)) {
self::addCssClass('btn-' . $color, $htmlOptions);
}
$size = TbArray::popValue('size', $htmlOptions);
if (!empty($size)) {
self::addCssClass('btn-' . $size, $htmlOptions);
}
if (TbArray::popValue('block', $htmlOptions, false)) {
self::addCssClass('btn-block', $htmlOptions);
}
if (TbArray::popValue('disabled', $htmlOptions, false)) {
self::addCssClass('disabled', $htmlOptions);
$htmlOptions['disabled'] = 'disabled';
}
$loading = TbArray::popValue('loading', $htmlOptions);
if (!empty($loading)) {
$htmlOptions['data-loading-text'] = $loading;
}
if (TbArray::popValue('toggle', $htmlOptions, false)) {
$htmlOptions['data-toggle'] = 'button';
}
$icon = TbArray::popValue('icon', $htmlOptions);
$iconOptions = TbArray::popValue('iconOptions', $htmlOptions, array());
if (!is_array($type) && strpos($type, 'input') === false) {
if (!empty($icon)) {
$label = self::icon($icon, $iconOptions) . ' ' . $label;
}
$items = TbArray::popValue('items', $htmlOptions);
}
$dropdownOptions = $htmlOptions;
TbArray::removeValues(array('groupOptions', 'menuOptions', 'dropup'), $htmlOptions);
self::addSpanClass($htmlOptions);
// must be called here as parent renders buttons
self::addPullClass($htmlOptions);
// must be called here as parent renders buttons
return isset($items) ? self::btnDropdown($type, $label, $items, $dropdownOptions) : self::createButton($type, $label, $htmlOptions);
}