Example #1
2
 /** @param \yii\web\Application $app */
 public function bootstrap($app)
 {
     if ($app instanceof \yii\web\Application) {
         \Yii::$app->setComponents(['user' => ['class' => 'giantbits\\crelish\\components\\CrelishUser', 'identityClass' => 'giantbits\\crelish\\components\\CrelishUser', 'enableAutoLogin' => true], 'defaultRoute' => 'frontend/index', 'view' => ['class' => 'yii\\web\\View', 'renderers' => ['twig' => ['class' => 'yii\\twig\\ViewRenderer', 'cachePath' => '@runtime/Twig/cache', 'options' => ['auto_reload' => true], 'globals' => ['html' => '\\yii\\helpers\\Html']]]], 'urlManager' => ['class' => 'yii\\web\\UrlManager', 'enablePrettyUrl' => TRUE, 'showScriptName' => FALSE, 'enableStrictParsing' => TRUE, 'suffix' => '.html', 'rules' => []], 'i18n' => ['class' => 'yii\\i18n\\I18N', 'translations' => ['app*' => ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@app/messages', 'sourceLanguage' => 'en-US', 'fileMap' => ['app' => 'app.php', 'app/error' => 'error.php'], 'on missingTranslation' => [CrelishI18nEventHandler::class, 'handleMissingTranslation']]]]]);
         $app->getUrlManager()->addRules([['class' => 'yii\\web\\UrlRule', 'pattern' => 'crelish/<controller:[\\w\\-]+>/<action:[\\w\\-]+>', 'route' => 'crelish/<controller>/<action>'], ['class' => 'yii\\web\\UrlRule', 'pattern' => 'crelish/<id:\\w+>', 'route' => 'crelish/default/view'], ['class' => 'yii\\web\\UrlRule', 'pattern' => 'crelish', 'route' => 'crelish/default/index'], ['class' => 'yii\\web\\UrlRule', 'pattern' => '<controller:[\\w\\-]+>/<action:[\\w\\-]+>', 'route' => '/<controller>/<action>'], ['class' => 'giantbits\\crelish\\components\\CrelishBaseUrlRule']], TRUE);
     }
     // Register crelish.
     \Yii::$app->setModules(['crelish' => ['class' => 'giantbits\\crelish\\Module', 'theme' => \Yii::$app->params['crelish']['theme']], 'redactor' => 'yii\\redactor\\RedactorModule']);
 }
Example #2
2
 /**
  * Bootstraps the module for the web application.
  *
  * @param \yii\web\Application $app application instance.
  */
 protected function bootstrapWebApplication($app)
 {
     /** @var Module $module */
     $module = $app->getModule(Module::MODULE_ID);
     // prepend the URL rules to the URL manager
     $app->getUrlManager()->addRules([new GroupUrlRule($module->urlConfig)], false);
     // Configure the web user component
     $app->set('user', ArrayHelper::merge(['class' => $module->getClassName(Module::CLASS_WEB_USER), 'identityClass' => $module->getClassName(Module::CLASS_ACCOUNT), 'loginUrl' => $module->createRoute(Module::URL_ROUTE_LOGIN), 'enableAutoLogin' => true], $module->userConfig));
     // configure client authentication if necessary
     if ($module->enableClientAuth && !$app->has('authClientCollection')) {
         $app->set('authClientCollection', ArrayHelper::merge(['class' => Collection::className(), 'clients' => ['google' => ['class' => GoogleOpenId::className()]]], $module->clientAuthConfig));
     }
 }
Example #3
0
 /**
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $urlManager = $app->getUrlManager();
     $urlManager->enablePrettyUrl = true;
     $id = $this->uniqueId;
     $urlManager->addRules([['class' => classes\GroupUrlRule::className(), 'prefix' => $id, 'suffix' => '', 'rules' => ['' => '', 'GET assignment' => 'assignment/index', 'GET assignment/<id>' => 'assignment/view', 'POST assignment/assign/<id>' => 'assignment/assign', 'POST assignment/revoke/<id>' => 'assignment/revoke', 'GET item' => 'item/index', 'GET item/<id>' => 'item/view', 'POST item/assign/<id>' => 'item/add-child', 'POST item/revoke/<id>' => 'item/remove-child', 'PUT item/<id>' => 'item/update', 'POST item' => 'item/create', 'DELETE item/<id>' => 'item/delete', 'GET rule' => 'rule/index', 'GET rule/<id>' => 'rule/view', 'POST rule/<id>' => 'rule/update', 'POST rule' => 'rule/create', 'DELETE rule/<id>' => 'rule/delete', 'GET route' => 'route/index', 'POST route/add' => 'route/add', 'POST route/remove' => 'route/remove', 'GET menu' => 'menu/index', 'GET menu/values' => 'menu/values', 'GET menu/<id>' => 'menu/view', 'POST menu/<id>' => 'menu/update', 'POST menu' => 'menu/create', 'DELETE menu/<id>' => 'menu/delete']]], false);
 }
Example #4
0
 /**
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     /* @var $module \marsoltys\yii2user\Module */
     $module = Yii::$app->getModule("user");
     $urlManager = $app->getUrlManager();
     //$urlManager->enablePrettyUrl = true;
     $urlManager->addRules($module->urlRules, true);
     $app->set('user', ['identityClass' => $module->identityClass, 'loginUrl' => $module->loginUrl, 'class' => $module->userClass]);
 }
Example #5
0
 /**
  * @inheritdoc
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules([$this->urlAliasAdminName . '/<controller:[\\w\\-]+>/<action:[\\w\\-]+>' => $this->id . '/<controller>/<action>'], false);
 }
Example #6
-1
 /**
  * @param \yii\web\Application $app
  */
 public function bootstrap($app)
 {
     $urlManager = $app->getUrlManager();
     $urlManager->enablePrettyUrl = true;
     $id = $this->uniqueId;
     $urlManager->addRules([$id => $id . '/default/index', 'GET ' . $id . '/assignment' => $id . '/assignment/index', 'GET ' . $id . '/assignment/<id>' => $id . '/assignment/view', 'POST ' . $id . '/assignment/assign/<id>' => $id . '/assignment/assign', 'POST ' . $id . '/assignment/revoke/<id>' => $id . '/assignment/revoke', 'GET ' . $id . '/item' => $id . '/item/index', 'GET ' . $id . '/item/<id>' => $id . '/item/view', 'POST ' . $id . '/item/assign/<id>' => $id . '/item/add-child', 'POST ' . $id . '/item/revoke/<id>' => $id . '/item/remove-child', 'PUT ' . $id . '/item/<id>' => $id . '/item/update', 'POST ' . $id . '/item' => $id . '/item/create', 'DELETE ' . $id . '/item/<id>' => $id . '/item/delete', 'GET ' . $id . '/rule' => $id . '/rule/index', 'GET ' . $id . '/rule/<id>' => $id . '/rule/view', 'POST ' . $id . '/rule/<id>' => $id . '/rule/update', 'POST ' . $id . '/rule' => $id . '/rule/create', 'DELETE ' . $id . '/rule/<id>' => $id . '/rule/delete', 'GET ' . $id . '/route' => $id . '/route/index', 'POST ' . $id . '/route/add' => $id . '/route/add', 'POST ' . $id . '/route/remove' => $id . '/route/remove', 'GET ' . $id . '/menu' => $id . '/menu/index', 'GET ' . $id . '/menu/values' => $id . '/menu/values', 'GET ' . $id . '/menu/<id>' => $id . '/menu/view', 'POST ' . $id . '/menu/<id>' => $id . '/menu/update', 'POST ' . $id . '/menu' => $id . '/menu/create', 'DELETE ' . $id . '/menu/<id>' => $id . '/menu/delete'], false);
 }