當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Module::init方法代碼示例

本文整理匯總了PHP中yii\base\Module::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP Module::init方法的具體用法?PHP Module::init怎麽用?PHP Module::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\base\Module的用法示例。


在下文中一共展示了Module::init方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 public function init()
 {
     parent::init();
     if (!\Yii::$app->user->can('adminDashboard')) {
         throw new ForbiddenHttpException('Access denied');
     }
 }
開發者ID:mops1k,項目名稱:yiimine,代碼行數:7,代碼來源:Module.php

示例2: init

 public function init()
 {
     parent::init();
     /*if ($app instanceof \yii\console\Application) {
     			$$this->controllerNamespace;
     		}*/
 }
開發者ID:mmelcor,項目名稱:yii2-transconv,代碼行數:7,代碼來源:Module.php

示例3: init

 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (\Yii::$app->authManager === null) {
         throw new InvalidConfigException('You forgot configure the "authManager" component.');
     }
     parent::init();
 }
開發者ID:vandro,項目名稱:gui-rbac-yii2,代碼行數:11,代碼來源:Module.php

示例4: init

 public function init()
 {
     // Menu backend
     $this->backendMenu = [['label' => Yii::t('message', 'Message'), 'url' => ['/message/default'], 'access' => ['message/backend/default/*', 'message/backend/default/index']], ['label' => Yii::t('common', 'Setting'), 'url' => ['/common/setting', 'module' => 'message'], 'access' => ['common/setting']]];
     parent::init();
     // custom initialization code goes here
 }
開發者ID:quynhvv,項目名稱:stepup,代碼行數:7,代碼來源:Module.php

示例5: init

 public function init()
 {
     parent::init();
     if (\Yii::$app instanceof \yii\console\Application) {
         $this->controllerNamespace = 'common\\modules\\rbac\\commands';
     }
 }
開發者ID:Humanized,項目名稱:viajero,代碼行數:7,代碼來源:Module.php

示例6: init

 public function init()
 {
     parent::init();
     if (is_null($this->attribute)) {
         throw new Exception("Module \"attribute\" attribute must be set");
     }
     if (is_null($this->latitudeAttribute)) {
         throw new Exception("Module \"latitudeAttribute\" attribute must be set");
     }
     if (is_null($this->longitudeAttribute)) {
         throw new Exception("Module \"longitudeAttribute\" attribute must be set");
     }
     if (is_null($this->jsonAttribute)) {
         throw new Exception("Module \"jsonAttribute\" attribute must be set");
     }
     if (is_null($this->class)) {
         $this->class = __NAMESPACE__ . '\\models\\Locations';
     }
     $location = new $this->class();
     $location->setAttributes(['destinationAttribute' => $this->attribute, 'latitudeAttribute' => $this->latitudeAttribute, 'longitudeAttribute' => $this->longitudeAttribute, 'jsonAttribute' => $this->jsonAttribute]);
     $this->location = $location;
     Event::on(Locations::className(), Locations::EVENT_ADD_LOCATION, [Locations::className(), 'addLocation']);
     Event::on(Locations::className(), Locations::EVENT_GET_LOCATION, [Locations::className(), 'getLocation']);
     return true;
 }
開發者ID:achertovsky,項目名稱:maplocation,代碼行數:25,代碼來源:Module.php

示例7: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $handler = new \yii\web\ErrorHandler(['errorAction' => 'empresas/default/error', 'errorView' => '@app/modules/empresas/views/default/error.php']);
     Yii::$app->set('errorHandler', $handler);
     $handler->register();
 }
開發者ID:alejandrososa,項目名稱:AB,代碼行數:10,代碼來源:Modulo.php

示例8: init

 public function init()
 {
     parent::init();
     //        \Yii::$app->request->setAcceptableContentTypes(['application/json' => ['q' => 1]]);
     \Yii::$app->user->enableSession = false;
     Helper::handle_response();
 }
開發者ID:nisnaker,項目名稱:yii2-template,代碼行數:7,代碼來源:Module.php

示例9: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->userIdentityClass === null) {
         $this->userIdentityClass = \Yii::$app->getUser()->identityClass;
     }
 }
開發者ID:frenzelgmbh,項目名稱:cm-communication,代碼行數:10,代碼來源:Module.php

示例10: init

 public function init()
 {
     parent::init();
     //        if (Yii::$app instanceof ConsoleApplication) {
     //            $this->controllerNamespace = 'app\modules\settings\commands';
     //        }
 }
開發者ID:kdes70,項目名稱:hotel.lok,代碼行數:7,代碼來源:Module.php

示例11: init

 /**
  * 
  */
 public function init()
 {
     $modulePathAlias = '@app/modules/' . $this->id;
     parent::init();
     $this->controllerNamespace = 'app\\modules\\' . $this->id . '\\controllers';
     Yii::$app->getI18n()->translations[$this->id . '*'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => $modulePathAlias . '/messages'];
 }
開發者ID:sheillendra,項目名稱:yii2-jeasyui,代碼行數:10,代碼來源:Module.php

示例12: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset(Yii::$app->i18n->translations['forum'])) {
         Yii::$app->i18n->translations['forum'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'ru', 'basePath' => '@terabyte/forum/messages'];
     }
 }
開發者ID:tecnologiaterabyte,項目名稱:yii2-forum,代碼行數:10,代碼來源:Module.php

示例13: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (is_callable($this->userId)) {
         $this->userId = call_user_func($this->userId);
     }
     parent::init();
 }
開發者ID:dextercool,項目名稱:yii2-notifications,代碼行數:10,代碼來源:NotificationsModule.php

示例14: init

 public function init()
 {
     parent::init();
     Yii::$app->user->loginUrl = ['admin/login'];
     Yii::$app->user->identityClass = 'app\\modules\\admin\\identity\\Admin';
     Yii::configure($this, $this->config());
 }
開發者ID:smackmybitchup,項目名稱:yii2project,代碼行數:7,代碼來源:AdminModule.php

示例15: init

 public function init()
 {
     parent::init();
     if (empty($this->reportSettings)) {
         throw new Exception('Empty reportSettings');
     }
 }
開發者ID:maxlen,項目名稱:pdffiller_proxy,代碼行數:7,代碼來源:ProxyCron.php


注:本文中的yii\base\Module::init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。