예제 #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->_modulesConfigDependency = new ExpressionDependency(['expression' => '\\Yii::$app->getModulesHash()']);
     DbState::bootstrap();
     Yii::$container->set('gromver\\modulequery\\ModuleQuery', ['cache' => $this->cache, 'cacheDependency' => new ExpressionDependency(['expression' => '\\Yii::$app->getModulesHash()'])]);
 }
예제 #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     //$this->initI18N();
     //$this->bootstrap = array_merge($this->bootstrap, ['main']);
     parent::init();
     $this->_modulesConfigDependency = new ExpressionDependency(['expression' => '\\Yii::$app->getModulesHash()']);
     DbState::bootstrap();
     Yii::$container->set('gromver\\models\\fields\\EditorField', ['controller' => 'media/manager', 'editorOptions' => ['filebrowserBrowseUrl' => ['/menu/backend/item/ckeditor-select'], 'autoGrow_onStartup' => true, 'autoGrow_bottomSpace' => 50]]);
     Yii::$container->set('gromver\\models\\fields\\MediaField', ['controller' => 'media/manager']);
     Yii::$container->set('gromver\\modulequery\\ModuleQuery', ['cache' => $this->cache, 'cacheDependency' => $this->_modulesConfigDependency]);
     Yii::$container->set('gromver\\platform\\core\\components\\MenuMap', ['cache' => $this->cache, 'cacheDependency' => DbState::dependency(MenuItem::tableName())]);
     Yii::$container->set('gromver\\platform\\core\\components\\MenuUrlRule', ['cache' => $this->cache, 'cacheDependency' => $this->_modulesConfigDependency]);
     Yii::$container->set('gromver\\platform\\core\\modules\\main\\widgets\\Desktop', ['cache' => $this->cache, 'cacheDependency' => $this->_modulesConfigDependency]);
     Yii::$container->set('gromver\\platform\\core\\components\\ParamsManager', ['cache' => $this->cache, 'cacheDependency' => $this->_modulesConfigDependency]);
     $this->urlManager->addRules($this->defaultUrlRules);
     $this->set('menuManager', \Yii::createObject(MenuManager::className()));
     // пропускаем \gromver\models\fields\events\ListItemsEvent событие, через ModuleEvent - не факт, что нужно, но почему бы и нет
     Event::on('\\gromver\\models\\fields\\ListField', 'fetchItems', function ($event) {
         /** @var $event \gromver\models\fields\events\ListItemsEvent */
         $additionalItems = @$this->listFieldItems[$event->model->getSourceClass() . '::' . $event->attribute];
         if (is_array($additionalItems)) {
             $event->items = array_merge($event->items, $additionalItems);
         }
     });
     $this->applyDefaultMetadata();
 }