init() public method

Initializes the widget.
public init ( )
コード例 #1
0
ファイル: LanguageMenu.php プロジェクト: shunwusong/timer
 /**
  * Initializes the widget.
  */
 public function init()
 {
     $languages = Yii::app()->getLanguages();
     $activeLocale = Yii::app()->language;
     $items = array(array('label' => 'Language'));
     foreach ($languages as $locale => $language) {
         if ($locale === $activeLocale) {
             $activeLanguage = $language;
         }
         $items[] = array('label' => $language, 'url' => array('/site/changeLanguage', 'locale' => $locale), 'active' => $locale === $activeLocale);
     }
     $label = isset($activeLanguage) ? $activeLanguage : 'Unknown';
     $this->items = array_merge(array(array('label' => $label, 'items' => $items)), $this->items);
     parent::init();
 }
コード例 #2
0
ファイル: ClientMenu.php プロジェクト: blindest/Yii-CMS-2.0
 public function init()
 {
     $this->attachBehaviors($this->behaviors());
     parent::init();
 }