Passing menu items as argument through partials

Hi Everybody,

I created a dimension menu that works well. Now I created a template that renders this menu as a partial. The partial itself was found but the menu contains the main menu items (pages) and not the language items. I assume that the items haven’t passed the template. Do you have an idea how to make them available in the partial? Thanks in advance!

Root.ts2

languageMenu = TYPO3.Neos:DimensionMenu {
    dimension = 'language'
    templatePath = 'resource://Vendor.Package/Private/Templates/TypoScriptObjects/TopMenu.html'
}

TopMenu.html

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <f:render partial="LanguageMenu" section="languageMenu" arguments="{items: items}" />
</nav>

LanguageMenu.html

<f:section name="languageMenu">
<div class="language-menu">
    <div>
        <f:for each="{items}" as="item">
            <f:if condition="{item.state} == 'current'"><span class="language-menu-full">{item.label}</span><span class="language-menu-short" title="{item.label}">{item.preset.uriSegment}</span></f:if>
        </f:for>
        <span>▼</span>
    </div>
    <ul{attributes -> f:format.raw()}>
    <f:for each="{items}" as="item">
        <li{ts:render(path:'{item.state}.attributes', context: {item: item}) -> f:format.raw()}>
            <f:if condition="{item.node}">
                <f:then>
                    <neos:link.node node="{item.node}"><span class="language-menu-full">{item.label}</span><span class="language-menu-short" title="{item.label}">{item.preset.uriSegment}</span></neos:link.node>
                </f:then>
                <f:else>
                    <span class="language-menu-full">{item.label}</span><span class="language-menu-short" title="{item.label}">{item.preset.uriSegment}</span>
                </f:else>
            </f:if>
        </li>
    </f:for>
    </ul>
</div>
</f:section>

Best,
Andreas

Does it work without the partial? It seems weird to me {items} would be lost passing it to a partial but it looks like that happens…

Yes it works without the partial. I tried to use a different variable like ‘langitems’ as an alternative but it didn’t work either.

languageMenu = TYPO3.Neos:DimensionMenu {
    dimension = 'language'
    templatePath = 'resource://Vendor.Package/Private/Templates/TypoScriptObjects/TopMenu.html'
    langitems = ${this.items}
}

Best,
Andreas

Thanks @hphoeksma for your reply! Sorry, bad behavior.

1 Like

So skip the partial :wink:
But this seems like a bug to me. Maybe provide a bug report with steps to reproduce ?