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">
<?php if (isset($menu->items)): ?>
<?php foreach ($menu->items as $item): ?>
<li class="<?= $item->isActive() ? 'active' : '' ?> nav-item<?= $item->hasChildren() ? ' dropdown' : '' ?>">
<?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>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<?php $children = $item->children; ?>
<?php foreach ($children as $child): ?>
<a <?= $child->target ? 'target="'.$child->target.'"' : '' ?> class="dropdown-item" href="<?= $child->url ?>"><?= $child->name ?></a>
<?php endforeach; ?>
</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; ?>
<?php if (isset($menu->items)): ?>
<?php foreach ($menu->items as $item): ?>
<li class="<?= $item->isActive() ? 'active' : '' ?> nav-item<?= $item->hasChildren() ? ' dropdown' : '' ?>">
<?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->translation->name ?></a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<?php $children = $item->children; ?>
<?php foreach ($children as $child): ?>
<a <?= $child->target ? 'target="' . $child->target . '"' : '' ?> class="dropdown-item"
href="<?= $child->url ?>"><?= $child->translation->name ?></a>
<?php endforeach; ?>
</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>
Loading…
Cancel
Save