init() public method

This method is called after the module is created and initialized with property values given in configuration. The default implementation will initialize [[controllerNamespace]] if it is not set. If you override this method, please make sure you call the parent implementation.
public init ( )
Example #1
3
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (\Yii::$app->authManager === null) {
         throw new InvalidConfigException('You forgot configure the "authManager" component.');
     }
     parent::init();
 }
Example #2
3
 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
 }
Example #3
3
 public function init()
 {
     parent::init();
     if (!\Yii::$app->user->can('adminDashboard')) {
         throw new ForbiddenHttpException('Access denied');
     }
 }
Example #4
3
 public function init()
 {
     parent::init();
     /*if ($app instanceof \yii\console\Application) {
     			$$this->controllerNamespace;
     		}*/
 }
Example #5
2
 public function init()
 {
     parent::init();
     if (\Yii::$app instanceof \yii\console\Application) {
         $this->controllerNamespace = 'common\\modules\\rbac\\commands';
     }
 }
Example #6
2
 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;
 }
Example #7
1
 /**
  * @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();
 }
Example #8
1
 public function init()
 {
     parent::init();
     //        \Yii::$app->request->setAcceptableContentTypes(['application/json' => ['q' => 1]]);
     \Yii::$app->user->enableSession = false;
     Helper::handle_response();
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (is_callable($this->userId)) {
         $this->userId = call_user_func($this->userId);
     }
     parent::init();
 }
Example #10
1
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->userIdentityClass === null) {
         $this->userIdentityClass = \Yii::$app->getUser()->identityClass;
     }
 }
Example #11
0
 public function init()
 {
     parent::init();
     //        if (Yii::$app instanceof ConsoleApplication) {
     //            $this->controllerNamespace = 'app\modules\settings\commands';
     //        }
 }
Example #12
0
 /**
  * 
  */
 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'];
 }
Example #13
0
 /**
  * @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'];
     }
 }
 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());
 }
Example #15
0
 public function init()
 {
     parent::init();
     if (empty($this->reportSettings)) {
         throw new Exception('Empty reportSettings');
     }
 }
Example #16
0
 public function init()
 {
     parent::init();
     $this->layout = 'admin';
     //podkluchaem layout adminki
     // custom initialization code goes here
 }
Example #17
0
 public function init()
 {
     if (\Yii::$app instanceof \yii\console\Application) {
         $this->controllerNamespace = 'humanized\\maintenance\\commands';
     }
     parent::init();
 }
Example #18
0
 public function init()
 {
     parent::init();
     //Задаємо шлях до шаблона субмодуля - в модулі Адмінки
     $this->setLayoutPath('@app/modules/admin/views/layouts');
     // custom initialization code goes here
 }
Example #19
0
 public function init()
 {
     parent::init();
     if (!$this->types) {
         $this->types = [1 => '积分', 2 => '声望', 3 => '徽章'];
     }
 }
Example #20
0
 public function init()
 {
     if (Yii::$app->user->isGuest || Yii::$app->user->id > 5) {
         die("Доступ закрыт! Вы не являетесь админом.");
     }
     parent::init();
 }
 public function init()
 {
     parent::init();
     if ($this->account === null || $this->password === null) {
         throw new InvalidParamException('Não foram informados a conta e/ou a senha.');
     }
 }
Example #22
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->params = ArrayHelper::merge($this->params(), $this->params);
     if (is_callable($this->controllerMap['elfinder'])) {
         $this->controllerMap['elfinder'] = call_user_func($this->controllerMap['elfinder'], $this->elfinderConfig());
     } else {
         if ($this->controllerMap['elfinder'] === true) {
             $this->controllerMap['elfinder'] = $this->elfinderConfig();
         }
     }
     $this->get('user')->loginUrl = [$this->id . '/default/login'];
     $this->widgets = ArrayHelper::merge(['FileManager' => '\\pavlinter\\adm\\widgets\\FileManager', 'FileInput' => '\\pavlinter\\adm\\widgets\\FileInput', 'GridView' => '\\pavlinter\\adm\\widgets\\GridView', 'DetailView' => '\\pavlinter\\adm\\widgets\\DetailView', 'Redactor' => '\\pavlinter\\adm\\widgets\\Redactor', 'ActiveForm' => '\\pavlinter\\adm\\widgets\\ActiveForm', 'Alert' => '\\pavlinter\\adm\\widgets\\Alert'], $this->widgets);
     $modules = $this->getModules();
     foreach ($modules as $name => $module) {
         if (is_integer($name)) {
             $module = Yii::$app->getModule($module);
         } else {
             $module = $this->getModule($name);
         }
         if ($module instanceof AdmBootstrapInterface) {
             $module->loading($this);
         }
     }
 }
Example #23
0
 public function init()
 {
     $this->controllerMap = ['elfinder' => ['class' => 'mihaildev\\elfinder\\Controller', 'access' => ['@'], 'disabledCommands' => ['netmount'], 'roots' => [['baseUrl' => $this->mediaUrl, 'basePath' => $this->mediaPath, 'path' => '', 'name' => 'Global']]]];
     $this->modules = ['settings' => ['class' => 'plathir\\settings\\Module', 'modulename' => 'blog'], 'treemanager' => ['class' => '\\kartik\\tree\\Module', 'treeViewSettings' => ['nodeActions' => [\kartik\tree\Module::NODE_MANAGE => Url::to(['/blog/categorytree/manage']), \kartik\tree\Module::NODE_SAVE => Url::to(['/blog/categorytree/save']), \kartik\tree\Module::NODE_REMOVE => Url::to(['/blog/categorytree/remove']), \kartik\tree\Module::NODE_MOVE => Url::to(['/blog/categorytree/move'])], 'nodeView' => '/categorytree/_form']]];
     parent::init();
     // custom initialization code goes here
 }
Example #24
0
 public function init()
 {
     parent::init();
     if (Yii::$app instanceof ConsoleApplication) {
         $this->controllerNamespace = 'app\\modules\\blog\\commands';
     }
 }
Example #25
0
 public function init()
 {
     parent::init();
     $this->layoutPath = \Yii::getAlias('@app/moduls/admin/views/layouts/');
     $this->layout = 'admin';
     // custom initialization code goes here
 }
Example #26
0
 public function init()
 {
     parent::init();
     if (!isset(Yii::$app->i18n->translations['rbac'])) {
         Yii::$app->i18n->translations['rbac'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@yiier/rbac/messages'];
     }
 }
 /**
  * @inherit
  */
 public function init()
 {
     parent::init();
     $this->registerTranslations();
     Reports::$classes_list = $this->_report_classes;
     Reports::$module = $this;
 }
Example #28
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->registerTranslations();
     $this->setupImageDirectory();
     Yii::$container->set($this->userClass);
 }
Example #29
-1
 public function init()
 {
     parent::init();
     // Yii::$app->user->identityClass = 'modules\api\models\ApiUserIdentity';
     Yii::$app->user->enableSession = false;
     Yii::$app->user->loginUrl = null;
 }
Example #30
-1
 public function init()
 {
     if (!isset(Yii::$app->i18n->translations['basket'])) {
         Yii::$app->i18n->translations['basket'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'ru-RU', 'basePath' => '@vendor/developer-av/yii2-basket/messages'];
     }
     parent::init();
 }