run() public method

Renders the widget.
public run ( )
Ejemplo n.º 1
0
 public function run()
 {
     $view = $this->getView();
     if ($this->clientOptions !== false) {
         $js = "\$.widget.bridge('uibutton', \$.ui.button);";
         $view->registerJs($js);
     }
     return parent::run();
 }
Ejemplo n.º 2
0
 /**
  * Renders the language drop down if there are currently more than one languages in the app.
  * If you pass an associative array of language names along with their code to the URL manager
  * those language names will be displayed in the drop down instead of their codes.
  */
 public function run()
 {
     $appLanguage = Yii::$app->language;
     if (count(Yii::$app->i18n->languages) > 1) {
         $items = [];
         foreach (Yii::$app->i18n->languages as $lang) {
             if ($lang === $appLanguage) {
                 $this->label = static::label($lang);
             }
             $item = ['label' => static::label($lang), 'url' => $this->getUrl($lang)];
             $items[] = $item;
         }
         $this->dropdown['items'] = $items;
         echo parent::run();
     }
 }
Ejemplo n.º 3
0
 /**
  * Renders the language drop down if there are currently more than one languages in the app.
  * If you pass an associative array of language names along with their code to the URL manager
  * those language names will be displayed in the drop down instead of their codes.
  */
 public function run()
 {
     $languages = isset(Yii::$app->getUrlManager()->languages) ? Yii::$app->getUrlManager()->languages : [];
     if (count($languages) > 1) {
         $items = [];
         $currentUrl = preg_replace('/' . Yii::$app->language . '\\//', '', Yii::$app->getRequest()->getUrl(), 1);
         $isAssociative = ArrayHelper::isAssociative($languages);
         foreach ($languages as $language => $code) {
             $url = $code . $currentUrl;
             if ($isAssociative) {
                 $item = ['label' => $language, 'url' => $url];
             } else {
                 $item = ['label' => $code, 'url' => $url];
             }
             if ($code === Yii::$app->language) {
                 $item['options']['class'] = 'disabled';
             }
             $items[] = $item;
         }
         $this->dropdown['items'] = $items;
         parent::run();
     }
 }
 public function run()
 {
     parent::run();
     $this->registerTableExportPlugin();
 }