params['search_rules'][] = "SELECT title, content, CONCAT('/pages/manage/page/view/', id) AS url FROM {{pages}}"; $app->getUrlManager()->addRules([ ['class' => 'common\modules\pages\urls\PageMainUrlRule'], ]); $app->getUrlManager()->addRules([ 'pages/manage/page/view/' => 'pages/manage/page/view', ]); // add languages $app->getI18n()->translations = ArrayHelper::merge($app->getI18n()->translations, [ 'page' => [ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@common/modules/pages/messages', ], 'page_public' => [ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@common/modules/pages/messages', ], ]); // add menu items if (basename($app->getBasePath()) === 'backend') { $app->params['adminMenu'][] = [ 'label' => \Yii::t( 'page', 'Pages' ), 'icon' => 'file-o', 'url' => [ '/pages/manage/page/index' ], 'visible' => \Yii::$app->user->can( 'admin' ) || \Yii::$app->user->can( 'PagesManagement' ) ]; } } public static function getMenuItemCreator($menu_id): array { $widgets = []; $widgets[] = [ 'id' => 'pages', 'title' => \Yii::t('page', 'Pages'), 'content' => MenuItemCreatorWidget::widget([ 'menu_id' => $menu_id, ]), ]; return $widgets; } }