Class hscstudio\heart\widgets\DropdownSide
Inheritance | hscstudio\heart\widgets\DropdownSide » yii\bootstrap\Widget |
---|---|
Available since version | 2.0 |
Dropdown renders a Bootstrap dropdown menu component.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$encodeLabels | boolean | Whether the labels for header items should be HTML-encoded. | hscstudio\heart\widgets\DropdownSide |
$items | array | List of menu items in the dropdown. | hscstudio\heart\widgets\DropdownSide |
Public Methods
Method | Description | Defined By |
---|---|---|
init() | Initializes the widget. | hscstudio\heart\widgets\DropdownSide |
run() | Renders the widget. | hscstudio\heart\widgets\DropdownSide |
Protected Methods
Method | Description | Defined By |
---|---|---|
renderItems() | Renders menu items. | hscstudio\heart\widgets\DropdownSide |
Property Details
Whether the labels for header items should be HTML-encoded.
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
- url: string, optional, the url of the item link. Defaults to "#".
- 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.
To insert divider use <li role="presentation" class="divider"></li>
.
Method Details
Initializes the widget.
If you override this method, make sure you call the parent implementation first.
void init( ) |
Renders menu items.
string renderItems( $items ) | ||
$items | array | The menu items to be rendered |
return | string | The rendering result. |
---|---|---|
throws | \yii\base\InvalidConfigException | if the label option is not specified in one of the items. |
Renders the widget.
void run( ) |