Accessing third level menu in Static Pages via twig.

- 1 answer

Ad

I have a dropdown menu which uses the static pages menu to generate the navigation.

How do I reference third level items? Here is a picture explaining a typical layout

enter image description here

I know bootstrap doesn't allow 3rd level menu without mods but its the the twig calls I am trying to work out.

There is a call for item.items and subitem in item.items. But what about the next level of items?

Here is my menu so far

<ul class="nav navbar-nav navbar-right">
    <li><a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ '/'|app }}"><i class="typcn typcn-home"></i></a></li>
    {% for item in items %}
    <li class="{{ item.isActive or item.isChildActive ? 'active' : '' }}  {{ item.items ? 'dropdown' : '' }}">
        <a title="{{ item.title }}" {% if item.items %} class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-     expanded="false" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"{% else %} target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ item.url }}" {% endif %}>{% if item.items %} {{ item.title }} <span class="caret"></span>{% else %} {{     item.title }} {% endif %}</a>
            {% if item.items %}
            <ul class="dropdown-menu">
            {% for subitem in item.items %}
            <li>
            <a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ subitem.url }}">{{ subitem.title }}</a>
            </li>
            {% endfor %} 
            </ul>
           {% endif %}
            </li>
    {% endfor %}

</ul>
Ad

Answer

Ad

The third level items are in

subitem.items
Ad
source: stackoverflow.com
Ad