/**
  * @return string
  */
 public function run()
 {
     $actions = $this->controller->actions;
     if ($actions && is_array($actions) && count($actions) >= 1) {
         $firstAction = array_shift($actions);
     }
     $style = '';
     $firstActionString = '';
     if ($firstAction && $this->renderFirstAction) {
         $actionDataJson = Json::encode($this->getActionData($firstAction));
         $tagOptions = ["onclick" => "new sx.classes.app.controllerAction({$actionDataJson}).go(); return false;", "class" => "btn btn-xs btn-default", "title" => $firstAction->name];
         $firstActionString = Html::a($this->getSpanIcon($firstAction), $this->getActionUrl($firstAction), $tagOptions);
         $style = 'min-width: 43px;';
     }
     return "<div class='{$this->containerClass}' title='" . \Yii::t('app', 'Possible actions') . "'>\n                    <div class=\"btn-group\" role=\"group\" style='{$style}'>\n                        {$firstActionString}\n                        <button type=\"button\" class='btn btn-xs btn-default' data-toggle=\"dropdown\">\n                           <span class=\"caret\"></span>\n                        </button>" . parent::run() . "\n                    </div>\n                </div>\n                ";
 }
Exemple #2
0
 /**
  * Рендер действий текущего контроллера
  * Сразу запускаем нужный виджет и формируем готовый html
  *
  * @return $this
  */
 protected function _initActionsData()
 {
     if (count($this->controller->actions) > 1) {
         $this->controller->view->params["actions"] = ControllerActions::begin(["activeActionId" => $this->id, "controller" => $this->controller])->run();
     }
     return $this;
 }