Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

ability to render sub-menus #57

Open
@dbu

Description

@dbu

it would be nice to have a way to just render the current submenu if there is one of that navigation depth. we can render from a menu item but not a a menu node. and we don't have a decent way to know how deep in the menu tree we currently are

this is the hack i came up with to get it going. but this is pretty ridiculous.

{% if cmfMainContent is defined and cmfMainContent.menus|length > 0 %}
    {% for menu in cmfMainContent.menus %}
        {% if menu.id|split('/')|length == 6 %}
            {% set main = menu.parent.name %}
            {% set sub = menu.name %}
            <div class="related_items">
                {{ knp_menu_render(['main', main, sub], { 'depth': 1 } ) }}
            </div>
        {% endif %}
        {% if menu.id|split('/')|length == 7 %}
            {% set main = menu.parent.parent.name %}
            {% set sub = menu.parent.name %}
            <div class="related_items">
                {{ knp_menu_render(['main', main, sub], { 'depth': 1, 'currentClass': 'selected' } ) }}
            </div>
        {% endif %}
    {% endfor %}
{% endif %}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions