public function run() { // Only show this widget if we're not on the error page if ($this->_isError) { return ''; } else { return parent::run(); } }
/** * @inheritdoc * @return string */ public function run() { $id = $this->options['id']; $options = $this->getClientOptions(); $options = empty($options) ? '' : Json::htmlEncode($options); $view =& $this->getView(); Yii2BootstrapAsset::register($view); $view->registerJs("jQuery('#{$id}').ajaxDropdown({$options});"); return parent::run(); }
public function run() { // Only show this widget if we're not on the error page if ($this->_isError || count(Yii::$app->urlManager->languages) < 2) { return ''; } else { $html = '<li class="dropdown ' . self::$_currentLanguageLabel . '"><a href="#" data-toggle="dropdown" class="dropdown-toggle">' . PHP_EOL . self::label(self::$_currentLanguageLabel) . '<b class="caret"></b></a>' . PHP_EOL; $html .= parent::run(); $html .= '</li>'; return $html; } }
/** * @inheritdoc */ public function run() { foreach ($this->items as &$item) { // icon ? if (isset($item['icon'])) { $icon = FA::icon($item['icon'] . ' fw'); $item['label'] = trim($icon . ' ' . ArrayHelper::getValue($item, 'label', '')); $item['encode'] = false; unset($item['icon']); } // active ? if (isset($item['active'])) { $active = $item['active']; if ($active instanceof \Closure) { $active = call_user_func($active, $this->getView()->getContext()); } if ($active) { Html::addCssClass($item['options'], 'active'); } unset($item['active']); } } return parent::run(); }
public function run() { $js = "//Dropdown menu, compatible with mobile ui\n"; $js .= "\$('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) {\n\t\t\tevent.preventDefault(); \n\t\t\tevent.stopPropagation(); \n\t\t\t\$(this).parent().siblings().removeClass('open');\n\t\t\t\$(this).parent().toggleClass('open');\n\t\t});"; $this->getView()->registerJs($js); return parent::run(); }