[Neos] Dimensionmenu: get dimension value in viewHelper

Robotic-Brain neos at roboticbrain.de
Wed Mar 11 23:21:45 CET 2015


Hello List,

I'm trying to write a custom DimensionMenu template.
Unfortunately I can't figure out how to get the dimension value...
 From the default template I know that {item.label} gives me the 
user-readable 'label' value from the Settings.yaml configuration. How 
can I get the dimension value then?

The use case is that I want to mark the different language links with 
specific css classes, so my css can display the corresponding flag(s). 
(specifically "lang_de" vs "lang_en")

Also, how can I sort the items, such that the "current" dimension gets 
rendered first?
Or is this already the case, by convention?

Thanks for any help and Cheers
Robotic-Brain

Below are the relevant (shortened) files:

Settings.yaml:
TYPO3:
   TYPO3CR:
     contentDimensions:
       'language':
         presets:
           'en':
             label: 'English'
             values: ['en', 'de']
           'de':
             label: 'Deutsch'
             values: ['de', 'en']


Template.html:
<f:for each="{items}" as="item">
     <f:if condition="{item.node}">
       <f:then>
         <neos:link.node node="{item.node}" class="langIcon lang_<<I WANT 
THE DIMENSION VALUE HERE>> {f:if(condition: '{item.state} == 
\'current\'', then: 'active')}" title="{item.label}"><span 
class="nobr"></span></neos:link.node>
       </f:then>
       <f:else>
         {item.label}
       </f:else>
     </f:if>
</f:for>



More information about the Neos mailing list