From 5dfc3ac6745137c878e4aefd1108e844851f5b3b Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sat, 28 Mar 2015 14:35:49 +0100 Subject: [PATCH] Allow customization of the dropdown caret This can be useful when another iconset is used for example. --- CHANGELOG.md | 1 + Nav.php | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1968bd6..3532d7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Yii Framework 2 bootstrap extension Change Log - Bug #5984: `yii\bootstrap\Activefield::checkbox()` caused browser to link label to the wrong input (cebe) - Enh #7633: Added `ActionColumn::$buttonOptions` for defining HTML options to be added to the default buttons (cebe) +- Enh: Added `Nav::$dropDownCaret` to allow customization of the dropdown caret symbol (cebe) 2.0.3 March 01, 2015 diff --git a/Nav.php b/Nav.php index e5d132f..498d86c 100644 --- a/Nav.php +++ b/Nav.php @@ -93,6 +93,12 @@ class Nav extends Widget * @see isItemActive */ public $params; + /** + * @var string this property allows you to customize the HTML which is used to generate the drop down caret symbol, + * which is displayed next to the button text to indicate the drop down functionality. + * Defaults to `null` which means `` will be used. To disable the caret, set this property to be an empty string. + */ + public $dropDownCaret; /** @@ -107,6 +113,9 @@ class Nav extends Widget if ($this->params === null) { $this->params = Yii::$app->request->getQueryParams(); } + if ($this->dropDownCaret === null) { + $this->dropDownCaret = Html::tag('b', '', ['class' => 'caret']); + } Html::addCssClass($this->options, 'nav'); } @@ -166,7 +175,9 @@ class Nav extends Widget $linkOptions['data-toggle'] = 'dropdown'; Html::addCssClass($options, 'dropdown'); Html::addCssClass($linkOptions, 'dropdown-toggle'); - $label .= ' ' . Html::tag('b', '', ['class' => 'caret']); + if ($this->dropDownCaret !== '') { + $label .= ' ' . $this->dropDownCaret; + } if (is_array($items)) { if ($this->activateItems) { $items = $this->isChildActive($items, $active);