[Neos] Dimensionmenu: get dimension value in viewHelper

Dmitri Pisarev dimaip at gmail.com
Thu Mar 12 08:19:51 CET 2015


Hello (Robotic-Brain?),
I don't know the answer to your question directly, but you can always put
<f:debug>{item}</f:debug> within the loop and see everything which is in
{item}.
Another (my favourite) way is to look at the source code of
DimensionsMenuImplementations:
$item = array(
'node' => $nodeInOtherDimension,
'state' => $this->calculateItemState($nodeInOtherDimension),
'label' => $presetConfiguration['label'],
'presetName' => $presetName,
'preset' => $presetConfiguration
);
So maybe {item.presetName} would work?

Regards,
Dmitri

On Thu, 12 Mar 2015 at 01:21 Robotic-Brain <neos at roboticbrain.de> wrote:

> 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>
>
> _______________________________________________
> Neos mailing list
> Neos at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/neos
>


More information about the Neos mailing list