/** * Generates the buttons that compound the group as specified on [[items]]. * @return string the rendering result. */ protected function renderButtons() { $buttons = []; foreach ($this->buttons as $button) { if (is_array($button)) { $label = ArrayHelper::getValue($button, 'label'); $options = ArrayHelper::getValue($button, 'options'); $buttons[] = Button::widget(['label' => $label, 'options' => $options, 'encodeLabel' => $this->encodeLabels]); } else { $buttons[] = $button; } } return implode("\n", $buttons); }
/** * Generates the button dropdown. * @return string the rendering result. */ protected function renderButton() { Html::addCssClass($this->options, 'btn'); if ($this->split) { $tag = 'button'; $options = $this->options; $this->options['data-toggle'] = 'dropdown'; Html::addCssClass($this->options, 'dropdown-toggle'); $splitButton = Button::widget(['label' => '<span class="caret"></span>', 'encodeLabel' => false, 'options' => $this->options]); } else { $tag = 'a'; $this->label .= ' <span class="caret"></span>'; $options = $this->options; if (!isset($options['href'])) { $options['href'] = '#'; } Html::addCssClass($options, 'dropdown-toggle'); $options['data-toggle'] = 'dropdown'; $splitButton = ''; } return Button::widget(['tagName' => $tag, 'label' => $this->label, 'options' => $options, 'encodeLabel' => false]) . "\n" . $splitButton; }