Exemple #1
0
 /**
  * Runs the widget.
  *
  * @return string the rendering result of this widget.
  */
 public function run()
 {
     $this->options = ArrayHelper::merge($this->getDefaultOptions(), $this->options);
     Html::addCssClass($this->options, $this->selector);
     $this->registerPlugin('popover');
     $this->getView()->registerJs('
         $(".' . $this->selector . '").popover();
     ');
     return parent::run();
 }
Exemple #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;
 }