menu_expand

Takes a menu, or a menu resource id, and adds all haspart objects connected to the menu ids.

With this filter it is possible to add a collection to the menu and have the pages in the collection automatically added to the menu.

Example:

{% with m.rsc.main_menu.menu|menu_expand as menu %}
    {% if menu %}
        {% with id|menu_trail:menu as trail %}
        <ul>
            {% for item in menu %}
                <li {% if item.id|member:trail %}class="active"{% endif %}>
                    <a href="{{ item.id.page_url }}">{{ item.id.title }}</a>
                </li>
            {% endfor %}
        </ul>
        {% endwith %}
    {% endif %}
{% endwith %}

Edit on GitHub