YiiFoundation
  • Namespace
  • Class
  • Tree

Namespaces

  • foundation
    • enum
    • exception
    • helpers
    • widgets
      • base
  • PHP

Classes

  • Alert
  • Breadcrumbs
  • Clearing
  • Dropdown
  • FlexVideo
  • Interchange
  • JoyRide
  • Magellan
  • Orbit
  • Pager
  • Reveal
  • Section
  • SwitchButton
  • Tooltip
  • TopBar

Class TopBar

TopBar widget renders a nav HTML component.

For example:

echo TopBar::widget(array(
    'leftItems' => array(
        array(
            'label' => 'Home',
            'url' => '/',
            'linkOptions' => array(...),
            'active' => true,
        ),
        array(
            'label' => 'Dropdown',
            'items' => array(
                 array(
                     'label' => 'Dropdown item A',
                     'url' => '#',
                 ),
                 array(
                     'label' => 'Dropdown item B',
                     'url' => '#',
                 ),
            ),
        ),
    ),
     'rightItems' => array(
        array(
            'label' => 'I am at right',
            'url' => '/',
            'linkOptions' => array(...),
            'active' => true,
        ),
        array(
            'label' => 'Dropdown',
            'items' => array(
                 array(
                     'label' => 'Dropdown item A',
                     'url' => '#',
                 ),
                 array(
                     'label' => 'Dropdown item B',
                     'url' => '#',
                 ),
            ),
        ),
    ),
));
CWidget
Extended by foundation\widgets\base\Widget
Extended by foundation\widgets\TopBar
Namespace: foundation\widgets
Package: foundation\widgets
Author: Antonio Ramirez <amigo.cobos@gmail.com>
Located at widgets/TopBar.php

Methods summary

public
# init( )

Initializes the widget

Initializes the widget

Overrides

foundation\widgets\base\Widget::init
public
# run( )

Renders the widget

Renders the widget

protected
# renderNavigation( )

Renders the navigation

Renders the navigation

protected string
# renderTitle( )

Renders the title of navigation

Renders the title of navigation

Returns

string
protected string
# renderItems( )

Renders widget's items.

Renders widget's items.

Returns

string
protected string
# renderItem( mixed $item )

Renders a widget's item

Renders a widget's item

Parameters

$item
mixed
$item the item to render

Returns

string
the rendering result.

Throws

InvalidConfigException

Methods inherited from foundation\widgets\base\Widget

display(), registerAssets(), registerEvents(), registerPlugin()

Magic methods summary

Properties summary

public string $title
#

$title the menu title

$title the menu title

public string $titleUrl
#

$titleUrl the menu url

$titleUrl the menu url

public array $titleOptions
#

$titleOptions the HTML-attributes of the title

$titleOptions the HTML-attributes of the title

public array $leftItems
#

list of left menu items in the topbar widget. Each array element represents a single menu item with the following structure:

  • label: string, required, the nav item label.
  • url: optional, the item's URL. Defaults to "#".
  • linkOptions: array, optional, the HTML attributes of the item's link.
  • options: array, optional, the HTML attributes of the item container (LI).
  • active: boolean, optional, whether the item should be on active state or not.
  • dropdown: array|string, optional, the items configuration array to render [[Nav::dropdown]],

    or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus.

list of left menu items in the topbar widget. Each array element represents a single menu item with the following structure:

  • label: string, required, the nav item label.
  • url: optional, the item's URL. Defaults to "#".
  • linkOptions: array, optional, the HTML attributes of the item's link.
  • options: array, optional, the HTML attributes of the item container (LI).
  • active: boolean, optional, whether the item should be on active state or not.
  • dropdown: array|string, optional, the items configuration array to render [[Nav::dropdown]], or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus.
public array $rightItems
#

list of right menu items in the topbar widget. Each array element represents a single menu item with the following structure:

  • label: string, required, the nav item label.
  • url: optional, the item's URL. Defaults to "#".
  • linkOptions: array, optional, the HTML attributes of the item's link.
  • options: array, optional, the HTML attributes of the item container (LI).
  • active: boolean, optional, whether the item should be on active state or not.
  • dropdown: array|string, optional, the items configuration array to render [[Nav::dropdown]],

    or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus.

list of right menu items in the topbar widget. Each array element represents a single menu item with the following structure:

  • label: string, required, the nav item label.
  • url: optional, the item's URL. Defaults to "#".
  • linkOptions: array, optional, the HTML attributes of the item's link.
  • options: array, optional, the HTML attributes of the item container (LI).
  • active: boolean, optional, whether the item should be on active state or not.
  • dropdown: array|string, optional, the items configuration array to render [[Nav::dropdown]], or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus.
public boolean $encodeLabels
#

whether the left|right items should be HTML-encoded

whether the left|right items should be HTML-encoded

public boolean $fixed
#

whether to make the bar fixed or not

whether to make the bar fixed or not

public boolean $containToGrid
#

whether to make the top bar contained to grid.

whether to make the top bar contained to grid.

public boolean $sticky
#

whether to make the top bar sticky. Sticky means that when the navigation its the top of the browser, it will act like the fixed top bar and stick to the top as users continue to scroll.

whether to make the top bar sticky. Sticky means that when the navigation its the top of the browser, it will act like the fixed top bar and stick to the top as users continue to scroll.

protected array $wrapperOptions
#

the HTML-attributes of the layer wrapping the nav tag. If empty, the wrapper wont be displayed.

the HTML-attributes of the layer wrapping the nav tag. If empty, the wrapper wont be displayed.

Properties inherited from foundation\widgets\base\Widget

$assets, $htmlOptions, $links

YiiFoundation API documentation generated by ApiGen 2.8.0