Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class Dropdown extends Widget
* @var array 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
* - 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.
Expand Down Expand Up @@ -101,13 +102,13 @@ protected function renderItems($items, $options = [])
{
$lines = [];
foreach ($items as $item) {
if (isset($item['visible']) && !$item['visible']) {
continue;
}
if (is_string($item)) {
$lines[] = $item;
continue;
}
if (isset($item['visible']) && !$item['visible']) {
continue;
}
if (!array_key_exists('label', $item)) {
throw new InvalidConfigException("The 'label' option is required.");
}
Expand Down