Example #1
0
 /**
  * Generates the buttons that compound the group as specified on [[buttons]].
  * @return string the rendering result.
  */
 protected function renderButtons()
 {
     $buttons = [];
     foreach ($this->buttons as $button) {
         if (is_array($button)) {
             $label = ArrayHelper::getValue($button, 'label');
             $url = ArrayHelper::getValue($button, 'url');
             $options = ArrayHelper::getValue($button, 'options');
             $button = Button::widget(['label' => $label, 'url' => $url, 'options' => $options, 'encodeLabel' => $this->encodeLabels]);
             $buttons[] = Html::tag('li', $button);
         } else {
             $buttons[] = Html::tag('li', $button);
         }
     }
     return implode("\n", $buttons);
 }
Example #2
0
 /**
  * Generates the button dropdown.
  * @return string the rendering result.
  */
 protected function renderButton($dropdown)
 {
     $dropdownId = $dropdown->getId();
     $label = $this->label;
     if ($this->encodeLabel) {
         $label = Html::encode($label);
     }
     if ($this->split) {
         $this->tagName = 'a';
         Html::addCssClass($this->options, 'button');
         Html::addCssClass($this->options, 'split');
         $options = $this->options;
         $label .= Html::tag('span', '', ['data-dropdown' => $dropdownId]);
     } else {
         Html::addCssClass($this->options, 'dropdown');
         $options = $this->options;
         $options['data-dropdown'] = $dropdownId;
     }
     return Button::widget(['tagName' => $this->tagName, 'label' => $label, 'options' => $options, 'url' => $this->url, 'encodeLabel' => false]) . "<br />\n";
 }