PHP Class yii\bootstrap\Dropdown

See also: http://getbootstrap.com/javascript/#dropdowns
Since: 2.0
Author: Antonio Ramirez ([email protected])
Inheritance: extends yii\bootstrap\Widget
Show file Open project: yiisoft/yii2-bootstrap Class Usage Examples

Public Properties

Property Type Description
$encodeLabels whether the labels for header items should be HTML-encoded.
$items list of menu items in the dropdown. Each array element can be either an HTML string, or an array representing a single menu with the following structure: - label: string, required, the label of the item link. - encode: boolean, optional, whether to HTML-ecnode item label. - url: string|array, optional, the url of the item link. This will be processed by [[Url::to()]]. If not set, the item will be treated as a menu header when the item has no sub-menu. - visible: boolean, optional, whether this menu item is visible. Defaults to true. - linkOptions: array, optional, the HTML attributes of the item link. - options: array, optional, the HTML attributes of the item. - items: array, optional, the submenu items. The structure is the same as this property. Note that Bootstrap doesn't support dropdown submenu. You have to add your own CSS styles to support it. - submenuOptions: array, optional, the HTML attributes for sub-menu container tag. If specified it will be merged with [[submenuOptions]]. To insert divider use .
$submenuOptions the HTML attributes for sub-menu container tags. If not set - [[options]] value will be used for it.

Public Methods

Method Description
init ( ) Initializes the widget.
run ( ) Renders the widget.

Protected Methods

Method Description
renderItems ( array $items, array $options = [] ) : string Renders menu items.

Method Details

init() public method

If you override this method, make sure you call the parent implementation first.
public init ( )

renderItems() protected method

Renders menu items.
protected renderItems ( array $items, array $options = [] ) : string
$items array the menu items to be rendered
$options array the container HTML attributes
return string the rendering result.

run() public method

Renders the widget.
public run ( )

Property Details

$encodeLabels public property

whether the labels for header items should be HTML-encoded.
public $encodeLabels

$items public property

list of menu items in the dropdown. Each array element can be either an HTML string, or an array representing a single menu with the following structure: - label: string, required, the label of the item link. - encode: boolean, optional, whether to HTML-ecnode item label. - url: string|array, optional, the url of the item link. This will be processed by [[Url::to()]]. If not set, the item will be treated as a menu header when the item has no sub-menu. - visible: boolean, optional, whether this menu item is visible. Defaults to true. - linkOptions: array, optional, the HTML attributes of the item link. - options: array, optional, the HTML attributes of the item. - items: array, optional, the submenu items. The structure is the same as this property. Note that Bootstrap doesn't support dropdown submenu. You have to add your own CSS styles to support it. - submenuOptions: array, optional, the HTML attributes for sub-menu container tag. If specified it will be merged with [[submenuOptions]]. To insert divider use .
public $items

$submenuOptions public property

the HTML attributes for sub-menu container tags. If not set - [[options]] value will be used for it.
Since: 2.0.5
public $submenuOptions