From 1603a2b028a83586cf1988dec741bd3e379a67f4 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Sun, 24 Jan 2016 18:28:21 +0200 Subject: [PATCH] `Nav::renderItem()` adjusted --- CHANGELOG.md | 1 + Nav.php | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63dbe32..46ba447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 bootstrap extension Change Log 2.0.6 under development ----------------------- +- Bug #68: Fixed `yii\bootstrap\Nav` handling empty items (freezy-sk) - Bug #81: Fixed `yii\bootstrap\ActiveField::radioList()` and `yii\bootstrap\ActiveField::checkboxList()` ignore `itemOptions` (mikehaertl) - Bug #98: Fixed `yii\bootstrap\ButtonDropdown` setting `href` attribute for non `a` tags (13nightevil) - Enh #45: Added support for Bootstrap checkbox/radio toggle buttons (RomeroMsk, klimov-paul) diff --git a/Nav.php b/Nav.php index 3a93c31..bf755e4 100644 --- a/Nav.php +++ b/Nav.php @@ -177,7 +177,9 @@ class Nav extends Widget $active = $this->isItemActive($item); } - if (!empty($items)) { + if (empty($items)) { + $items = ''; + } else { $linkOptions['data-toggle'] = 'dropdown'; Html::addCssClass($options, ['widget' => 'dropdown']); Html::addCssClass($linkOptions, ['widget' => 'dropdown-toggle']); @@ -192,10 +194,6 @@ class Nav extends Widget } } - if (empty($items)) { - $items = ''; - } - if ($this->activateItems && $active) { Html::addCssClass($options, 'active'); }