Commit 9fbe1412e956766b56e811c0071c54179d0924d5
1 parent
2e633ffb
-Services in menu ready
Showing
2 changed files
with
43 additions
and
24 deletions
Show diff stats
1 | +<?php | ||
2 | + | ||
3 | + use artbox\core\models\PageCategory; | ||
4 | + use yii\helpers\Url; | ||
5 | + use yii\web\View; | ||
6 | + | ||
7 | + /** | ||
8 | + * @var View $this | ||
9 | + * @var PageCategory[] $pageCategories | ||
10 | + */ | ||
11 | + | ||
12 | + if (!empty($pageCategories)) { | ||
13 | + ?> | ||
14 | + <ul class="_dropdown"> | ||
15 | + <?php foreach ($pageCategories as $category) { ?> | ||
16 | + <li> | ||
17 | + <a href="#"><?= $category->lang->title ?></a> | ||
18 | + <?php if (!empty($category->pages)) { ?> | ||
19 | + <ul> | ||
20 | + <?php foreach ($category->pages as $page) { ?> | ||
21 | + <li><a href="<?= Url::to( | ||
22 | + [ | ||
23 | + 'page/view', | ||
24 | + 'alias' => $page->lang->alias, | ||
25 | + ] | ||
26 | + ) ?>"><?= $page->lang->title ?></a></li> | ||
27 | + <?php } ?> | ||
28 | + </ul> | ||
29 | + <?php } ?> | ||
30 | + </li> | ||
31 | + <?php } ?> | ||
32 | + </ul> | ||
33 | + <?php } | ||
0 | \ No newline at end of file | 34 | \ No newline at end of file |
frontend/views/layouts/main.php
@@ -39,7 +39,6 @@ | @@ -39,7 +39,6 @@ | ||
39 | 'lang', | 39 | 'lang', |
40 | 'pages' => function (ActiveQuery $query) { | 40 | 'pages' => function (ActiveQuery $query) { |
41 | $query->with('lang.alias') | 41 | $query->with('lang.alias') |
42 | - ->where([ 'in_menu' => true ]) | ||
43 | ->orderBy([ 'sort' => SORT_ASC ]); | 42 | ->orderBy([ 'sort' => SORT_ASC ]); |
44 | }, | 43 | }, |
45 | ] | 44 | ] |
@@ -275,30 +274,17 @@ _________________________________________________________ --> | @@ -275,30 +274,17 @@ _________________________________________________________ --> | ||
275 | <?php | 274 | <?php |
276 | $items = []; | 275 | $items = []; |
277 | $items[] = [ | 276 | $items[] = [ |
278 | - 'label' => \Yii::t('app', 'Главная'), | ||
279 | - 'url' => [ 'site/index' ], | 277 | + 'label' => \Yii::t('app', 'Услуги'), |
278 | + 'items' => $this->render( | ||
279 | + '_services', | ||
280 | + [ | ||
281 | + 'pageCategories' => $pageCategories, | ||
282 | + ] | ||
283 | + ), | ||
284 | + 'options' => [ | ||
285 | + 'class' => '_dropdown-wr', | ||
286 | + ], | ||
280 | ]; | 287 | ]; |
281 | - foreach ($pageCategories as $category) { | ||
282 | - if (empty($category->pages)) { | ||
283 | - continue; | ||
284 | - } | ||
285 | - $pages = []; | ||
286 | - foreach ($category->pages as $page) { | ||
287 | - $pages[] = [ | ||
288 | - 'label' => $page->lang->title, | ||
289 | - 'url' => Url::to( | ||
290 | - [ | ||
291 | - 'page/view', | ||
292 | - 'alias' => $page->lang->alias, | ||
293 | - ] | ||
294 | - ), | ||
295 | - ]; | ||
296 | - } | ||
297 | - $items[] = [ | ||
298 | - 'label' => $category->lang->title, | ||
299 | - 'items' => $pages, | ||
300 | - ]; | ||
301 | - } | ||
302 | $items[] = [ | 288 | $items[] = [ |
303 | 'label' => \Yii::t('app', 'О клинике'), | 289 | 'label' => \Yii::t('app', 'О клинике'), |
304 | 'url' => [ 'site/about' ], | 290 | 'url' => [ 'site/about' ], |