diff --git a/backend/views/layouts/menu_items.php b/backend/views/layouts/menu_items.php index 4a359b4..6850801 100755 --- a/backend/views/layouts/menu_items.php +++ b/backend/views/layouts/menu_items.php @@ -35,9 +35,14 @@ 'icon' => 'file-text', 'items' => [ [ - 'label' => \Yii::t('core', 'Static pages'), + 'label' => \Yii::t('core', 'Pages'), 'url' => [ '/page/index' ], 'icon' => 'file-text', + ], + [ + 'label' => \Yii::t('core', 'Categories'), + 'url' => [ '/page-category/index' ], + 'icon' => 'archive', ] ], ], diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index e761ba2..de2915f 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -1,14 +1,17 @@ controller; $default_controller = Yii::$app->defaultRoute; $isHome = ( ( $controller->id === $default_controller ) && ( $controller->action->id === $controller->defaultAction ) ) ? true : false; - /** - * @var Page[] $pages - */ - $pages = Page::find() - ->where([ 'in_menu' => true ]) - ->with('lang.alias') - ->all(); + + $pageCategories = PageCategory::find() + ->with( + [ + 'lang', + 'pages' => function (ActiveQuery $query) { + $query->with('lang.alias') + ->where(['in_menu' => true]) + ->orderBy([ 'sort' => SORT_ASC ]); + }, + ] + ) + ->where([ 'status' => true ]) + ->orderBy([ 'sort' => SORT_ASC ]) + ->all(); $logo = null; if ($settings->logo) { $logo_img = ImageManager::findOne($settings->logo); @@ -80,7 +91,7 @@ ga('create', '=$settings->ga_code?>', 'auto'); ga('send', 'pageview'); - +