I’m totally new to Neos, just started playing with it 2 days ago, so please bear with me.
I’m currently trying to render a language menu based on Neos.Neos:DimensionsMenu
. So far so good, I’ve managed to point to a custom template via fusion:
languageMenu = Neos.Neos:DimensionsMenu {
attributes.class = 'dropdown-menu'
dimension = 'language'
templatePath = 'resource://First.Test/Private/Templates/Page/LanguageMenu.html'
}
The template is basically a slightly modified copy of the default menu template. Here’s the relevant part:
<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}">
<f:render section="itemLabel" arguments="{item:item}"/>
</neos:link.node>
</f:then>
<f:else>
<neos:link.node node="node://904a7cb6-ea53-4c3c-ade2-e71d2545bd08">
<f:render section="itemLabel" arguments="{item:item}"/>
</neos:link.node>
</f:else>
</f:if>
</li>
</f:for>
</ul>
Some pages do have no translated counter parts (item.state = absent
), and for these pages I would like to generate a link to the root page (904a7cb6-ea53-4c3c-ade2-e71d2545bd08
, which exists for all languages). Targeting the node as shown above however will always generate a link in the curent language, and I need to be able to generate a link to it in the language (dimension) of the current {item}
.
So I’m wondering where and how I could/should hook in, in order to retrieve/link to this fallback node in a specific language? In the template? Via fusion? Maybe in an extended class (ex DimensionsMenuImplementation::findAcceptableNode()
)?
Regards
Timo