diff --git a/Dropdown.php b/Dropdown.php index b68ac11..c96ef9a 100644 --- a/Dropdown.php +++ b/Dropdown.php @@ -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. @@ -101,13 +102,13 @@ class Dropdown extends Widget { $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."); }