From e6be9fd947c068d6e61e28543283ad5bf94159c4 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 18 Jul 2014 19:24:34 +0400 Subject: [PATCH] Even better fix for #3443 --- extensions/bootstrap/Dropdown.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extensions/bootstrap/Dropdown.php b/extensions/bootstrap/Dropdown.php index 10fe5c3001..21681d78dc 100644 --- a/extensions/bootstrap/Dropdown.php +++ b/extensions/bootstrap/Dropdown.php @@ -56,16 +56,17 @@ class Dropdown extends Widget */ public function run() { - echo $this->renderItems($this->items); + echo $this->renderItems($this->items, $this->options); } /** * Renders menu items. * @param array $items the menu items to be rendered + * @param array $containerOptions the HTML attributes for the widget container tag * @return string the rendering result. * @throws InvalidConfigException if the label option is not specified in one of the items. */ - protected function renderItems($items) + protected function renderItems($items, $containerOptions) { $lines = []; foreach ($items as $i => $item) { @@ -87,8 +88,8 @@ class Dropdown extends Widget $linkOptions['tabindex'] = '-1'; $content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions); if (!empty($item['items'])) { - unset($this->options['id']); - $this->renderItems($item['items']); + unset($containerOptions['id']); + $this->renderItems($item['items'], $containerOptions); Html::addCssClass($options, 'dropdown-submenu'); } $lines[] = Html::tag('li', $content, $options);