TbHtml::nav PHP Method

nav() public static method

Generates a navigation menu.
public static nav ( string $type, array $items, array $htmlOptions = [] ) : string
$type string the menu type.
$items array the menu items.
$htmlOptions array additional HTML attributes.
return string the generated menu.
    public static function nav($type, $items, $htmlOptions = array())
    {
        self::addCssClass('nav', $htmlOptions);
        if (!empty($type)) {
            self::addCssClass('nav-' . $type, $htmlOptions);
        } else {
            self::addCssClass('navbar-nav', $htmlOptions);
        }
        $stacked = TbArray::popValue('stacked', $htmlOptions, false);
        if ($type !== self::NAV_TYPE_LIST && $stacked) {
            self::addCssClass('nav-stacked', $htmlOptions);
        }
        return self::menu($items, $htmlOptions);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     if (!empty($this->items)) {
         //echo TbHtml::nav($this->type, $this->items, $this->htmlOptions);
         echo TbHtml::nav($this->type, $this->items, $this->htmlOptions, $this->submenuHtmlOptions);
         //add submenuHtmlOptions parameter
     }
 }
All Usage Examples Of TbHtml::nav
TbHtml