Esempio n. 1
0
 /**
  * @inheritdoc
  */
 protected function renderDropdown($items, $parentItem)
 {
     return Dropdown::widget(['options' => ArrayHelper::getValue($parentItem, 'dropDownOptions', []), 'items' => $items, 'encodeLabels' => $this->encodeLabels, 'clientOptions' => false, 'view' => $this->getView()]);
 }
Esempio n. 2
0
 /**
  * Render a dropdown button
  * @return string
  */
 protected function renderDropdown()
 {
     // build button(s)
     $caret = '<span class="caret"></span>';
     if ($this->split) {
         $button = parent::run();
         $button .= self::widget(['label' => $caret, 'encodeLabel' => false, 'type' => $this->type, 'options' => ['class' => 'dropdown-toggle', 'data-toggle' => 'dropdown']]);
     } else {
         $this->label .= " {$caret}";
         $this->encodeLabel = false;
         $this->tooltip = '';
         $this->options['data-toggle'] = 'dropdown';
         Html::addCssClass($this->options, 'dropdown-toggle');
         $button = parent::run();
     }
     // build dropdown
     $dropdown = Dropdown::widget(['items' => $this->items]);
     // return button group
     $buttonGroup = Html::tag('div', "{$button}\n{$dropdown}", ['class' => 'btn-group']);
     return $buttonGroup;
 }