/**
  * Renders the widget.
  * 
  * @return string the created button dropdowns.
  */
 public function run()
 {
     $this->pjaxContainer === null ?: $this->registerScripts();
     $tag = ArrayHelper::remove($this->containerOptions, 'tag', 'div');
     return implode("\n", [Html::beginTag($tag, $this->containerOptions), $this->renderButtonDropdown(), $this->renderDropdown(), Html::endTag('div')]);
 }
Ejemplo n.º 2
0
 /**
  * Creates a data cell content
  * 
  * @param \yii\db\ActiveRecord $model the data model
  * @param mixed $key the key associated with the data model
  * @param integer $index the current row index
  * @return string the created cell content
  */
 public function renderDataCellContent($model, $key, $index)
 {
     preg_match_all('/\\{([\\w\\-\\/]+)\\}/', $this->template, $matches);
     $items[] = $this->getPrependContent($model, $key, $index);
     $items[] = Html::beginTag('div', $this->actionOptions);
     foreach ($matches[1] as $name) {
         if (isset($this->buttons[$name])) {
             $url = $this->createUrl($name, $model, $key, $index);
             $item = call_user_func($this->buttons[$name], $url, $model, $key, $index);
             if ($item !== '') {
                 $items[] = Html::tag('span', $item, ['class' => $name]);
             }
         }
     }
     $items[] = Html::endTag('div');
     $items[] = $this->append instanceof Closure ? call_user_func($this->append, $model, $key, $index) : $this->append;
     return implode("\n", $items);
 }