Browse Source

Allow customization of the dropdown caret

This can be useful when another iconset is used for example.
tags/2.0.4
Carsten Brandt 10 years ago
parent
commit
5dfc3ac674
  1. 1
      CHANGELOG.md
  2. 13
      Nav.php

1
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) - 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 #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 2.0.3 March 01, 2015

13
Nav.php

@ -93,6 +93,12 @@ class Nav extends Widget
* @see isItemActive * @see isItemActive
*/ */
public $params; 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 `<b class="caret"></b>` 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) { if ($this->params === null) {
$this->params = Yii::$app->request->getQueryParams(); $this->params = Yii::$app->request->getQueryParams();
} }
if ($this->dropDownCaret === null) {
$this->dropDownCaret = Html::tag('b', '', ['class' => 'caret']);
}
Html::addCssClass($this->options, 'nav'); Html::addCssClass($this->options, 'nav');
} }
@ -166,7 +175,9 @@ class Nav extends Widget
$linkOptions['data-toggle'] = 'dropdown'; $linkOptions['data-toggle'] = 'dropdown';
Html::addCssClass($options, 'dropdown'); Html::addCssClass($options, 'dropdown');
Html::addCssClass($linkOptions, 'dropdown-toggle'); Html::addCssClass($linkOptions, 'dropdown-toggle');
$label .= ' ' . Html::tag('b', '', ['class' => 'caret']); if ($this->dropDownCaret !== '') {
$label .= ' ' . $this->dropDownCaret;
}
if (is_array($items)) { if (is_array($items)) {
if ($this->activateItems) { if ($this->activateItems) {
$items = $this->isChildActive($items, $active); $items = $this->isChildActive($items, $active);

Loading…
Cancel
Save