TbHtml::tabbable PHP Method

tabbable() public static method

Generates a tabbable menu.
public static tabbable ( string $type, array $tabs, array $htmlOptions = [] ) : string
$type string the menu type.
$tabs array the tab configurations.
$htmlOptions array additional HTML attributes.
return string the generated menu.
    public static function tabbable($type, $tabs, $htmlOptions = array())
    {
        self::addCssClass('tabbable', $htmlOptions);
        $placement = TbArray::popValue('placement', $htmlOptions);
        if (!empty($placement)) {
            self::addCssClass('tabs-' . $placement, $htmlOptions);
        }
        $menuOptions = TbArray::popValue('menuOptions', $htmlOptions, array());
        $contentOptions = TbArray::popValue('contentOptions', $htmlOptions, array());
        self::addCssClass('tab-content', $contentOptions);
        $panes = array();
        $items = self::normalizeTabs($tabs, $panes);
        $menu = self::nav($type, $items, $menuOptions);
        $content = self::tag('div', $contentOptions, implode('', $panes));
        $output = self::openTag('div', $htmlOptions);
        $output .= $placement === self::TABS_PLACEMENT_BELOW ? $content . $menu : $menu . $content;
        $output .= '</div>';
        return $output;
    }

Usage Example

Example #1
0
 /**
  * Widget's run method
  */
 public function run()
 {
     $this->tabs = $this->normalizeTabs($this->tabs);
     echo TbHtml::tabbable($this->type, $this->tabs, $this->htmlOptions);
     $this->registerClientScript();
 }
All Usage Examples Of TbHtml::tabbable
TbHtml