diff --git a/CHANGE.md b/CHANGE.md index c2074fa..0d4cc50 100644 --- a/CHANGE.md +++ b/CHANGE.md @@ -1,5 +1,20 @@ +version 2.7.0 +============= +**Date:** 18-Jul-2014 + +1. enh #96: Enhanced DatePicker, DateTimePicker, and TimePicker to work along with the new `autoWidgetSettings` for DateControl module . +2. enh #98: Added `language` configuration property for DatePicker, DateTimePicker, and TimePicker. +3. bug #99: Fix DateControl to work for date time formatting with DateTimePicker. +4. enh #104: Add more information to documentation for Select2 widget and explain placeholder setting when `allowClear` is `true`. +5. enh #106: Added Turkish translations for FileInput widget. +6. bug #110: Allow use of Select2 with tags, when tags are empty. +7. enh #111: Allow configuring of template for each item in SideNav. +8. Added `iconPrefix` property in SideNav to easily configure with more icon frameworks (other than glyphicon). + version 2.6.0 ============= +**Date:** 01-Jul-2014 + 1. Issue Fixes from #73 to #95. 2. Added `language` property to `InputWidget` along with `initLanguage` method for automatic language setting in `pluginOptions`. The `language` property will be auto defaulted to `Yii::$app->language` if not set. diff --git a/widgets/SideNav.php b/widgets/SideNav.php index a3a6865..0b6a6e3 100755 --- a/widgets/SideNav.php +++ b/widgets/SideNav.php @@ -3,7 +3,7 @@ /** * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2013 * @package yii2-widgets - * @version 1.0.0 + * @version 1.1.0 */ namespace kartik\widgets; @@ -62,6 +62,13 @@ class SideNav extends \yii\widgets\Menu */ public $type = self::TYPE_DEFAULT; + /** + * @var string prefix for the icon in [[items]]. This string will be prepended + * before the icon name to get the icon CSS class. This defaults to `glyphicon glyphicon-` + * for usage with glyphicons available with Bootstrap. + */ + public $iconPrefix = 'glyphicon glyphicon-'; + /** * @var array string/boolean the sidenav heading. This is not HTML encoded * When set to false or null, no heading container will be displayed. @@ -101,7 +108,6 @@ class SideNav extends \yii\widgets\Menu * - icon: string, optional, specifies the glyphicon name to be placed before label. * - url: string or array, optional, specifies the URL of the menu item. It will be processed by [[Url::to]]. * When this is set, the actual menu item content will be generated using [[linkTemplate]]; - * otherwise, [[labelTemplate]] will be used. * - visible: boolean, optional, whether this menu item is visible. Defaults to true. * - items: array, optional, specifies the sub-menu items. Its format is the same as the parent items. * - active: boolean, optional, whether this menu item is in active state (currently selected). @@ -111,7 +117,7 @@ class SideNav extends \yii\widgets\Menu * - template: string, optional, the template used to render the content of this menu item. * The token `{url}` will be replaced by the URL associated with this menu item, * and the token `{label}` will be replaced by the label of the menu item. - * If this option is not set, [[linkTemplate]] or [[labelTemplate]] will be used instead. + * If this option is not set, [[linkTemplate]] will be used instead. * - options: array, optional, the HTML attributes for the menu item tag. * */ @@ -201,8 +207,8 @@ protected function markTopItems() protected function renderItem($item) { $this->validateItems($item); + $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate); $url = Url::to(ArrayHelper::getValue($item, 'url', '#')); - $template = $this->linkTemplate; if (empty($item['top'])) { if (empty($item['items'])) { $template = str_replace('{icon}', $this->indItem . '{icon}', $template); @@ -214,7 +220,7 @@ protected function renderItem($item) $template = str_replace('{icon}', $indicator . '{icon}', $template); } } - $icon = empty($item['icon']) ? '' : '  '; + $icon = empty($item['icon']) ? '' : '  '; unset($item['icon'], $item['top']); return strtr($template, [ '{url}' => $url,