Browse Source

Frontend single language menu fix 2

master
Egorka 6 years ago
parent
commit
923455cffb
  1. 41
      core/widgets/menu/views/menu.php

41
core/widgets/menu/views/menu.php

@ -12,21 +12,28 @@
?> ?>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<?php if (isset($menu->items)): ?> <?php if (isset($menu->items)): ?>
<?php foreach ($menu->items as $item): ?> <?php foreach ($menu->items as $item): ?>
<li class="<?= $item->isActive() ? 'active' : '' ?> nav-item<?= $item->hasChildren() ? ' dropdown' : '' ?>"> <li class="<?= $item->isActive() ? 'active' : '' ?> nav-item<?= $item->hasChildren() ? ' dropdown' : '' ?>">
<?php if ($item->hasChildren() && $item->parent_id == 0): ?> <?php if ($item->hasChildren() && $item->parent_id == 0): ?>
<a <?= $item->target ? 'target="'.$item->target.'"' : '' ?> href="<?= $item->getUrl() ?>" class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?= $item->name ?></a> <a <?= $item->target ? 'target="' . $item->target . '"' : '' ?> href="<?= $item->getUrl() ?>"
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> class="nav-link dropdown-toggle"
<?php $children = $item->children; ?> id="navbarDropdownMenuLink"
<?php foreach ($children as $child): ?> data-toggle="dropdown"
<a <?= $child->target ? 'target="'.$child->target.'"' : '' ?> class="dropdown-item" href="<?= $child->url ?>"><?= $child->name ?></a> aria-haspopup="true"
<?php endforeach; ?> aria-expanded="false"><?= $item->translation->name ?></a>
</div> <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<?php elseif ($item->parent_id == 0): ?> <?php $children = $item->children; ?>
<a <?= $item->target ? 'target="'.$item->target.'"' : '' ?> href="<?= $item->getUrl() ?>" class="nav-link"><?= $item->translation->name ?></a> <?php foreach ($children as $child): ?>
<?php endif; ?> <a <?= $child->target ? 'target="' . $child->target . '"' : '' ?> class="dropdown-item"
</li> href="<?= $child->url ?>"><?= $child->translation->name ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> </div>
<?php elseif ($item->parent_id == 0): ?>
<a <?= $item->target ? 'target="' . $item->target . '"' : '' ?> href="<?= $item->getUrl() ?>"
class="nav-link"><?= $item->translation->name ?></a>
<?php endif; ?>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul> </ul>
Loading…
Cancel
Save