Acces Modular Parent from Modular

This is a total Newbie question, but I am not sure where to look for the answer. I am looking at the Modular example, and instead of using the buttons information in the showcase module to replace the header nav in the modular.html.twig, I want to iterate through the modular sections and show them as buttons inside of the showcase.html.twig.

So how do I do this? How do I get access to the “parent” modular from within the modular page

Instead of this inside showcase.html.twig

   {% for button in page.header.buttons %}
        <a class="button{% if button.primary %} primary{% endif %}" href="{{ button.url }}">{{ button.text }}</a>
    {% endfor %}

I want to do something like this:

	{% for module in page.activeParent.collection() %}

            {% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
            <a class="button"href="#{{ _self.pageLinkName(module.menu) }}">{{ module.menu }}</a>

    {% endfor %}

Also is this TWIG syntax or PHP or Grave? What documentation should Iook at for this to understand the syntax.

Thanks

ok I am almost there. I have the parent part figured out, the button shows the proper name but the link is empty. Why is the {{ _self.pageLinkName(module.menu) }} not working

    {% for module in page.parent.collection() %}

            {% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
            <a class="button"href="#{{ _self.pageLinkName(module.menu) }}">{{ module.menu }}</a>

    {% endfor %}

---

Problem solved. I did not realize that the pageLinkName was a macro that was available in the parent. I copied it to the partial and all is good now:

updated showcase:

{% macro pageLinkName(text) %},{{ text|lower|replace({' ':'_'}) }},{% endmacro %}

{% set showcase_image = page.media.images|first.grayscale().contrast(20).brightness(-125).colo rize(-35,81,122) %}
{% if showcase_image %}
	<div class="modular-row showcase flush-top" style="background-image: url({{ showcase_image.url }});">
{% else %}
<div class="modular-row showcase">
{% endif %}
    {{ content }}

    {% for module in page.parent.collection() %}

            {% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
            {% if module.menu != "Top" %}
            <a class="button"href="#{{ _self.pageLinkName(module.menu) }}">{{ module.menu }}</a>
            {% endif %}
    {% endfor %}
</div> 
---

Glad I could be of so much help! :slight_smile: Seriously glad you sorted it out, your example will prove helpful to others i’m sure.