I have in file DistributionPackages/Custom.Site/Configuration/Settings.CR.yaml
Neos:
Neos:
sites:
'*':
contentDimensions:
# the defaultDimensionSpacePoint is used when resolving the "/" URL.
defaultDimensionSpacePoint:
language: en_US
resolver:
factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\UriPathResolverFactory
options:
segments:
- dimensionIdentifier: language
dimensionValueMapping:
# dimension value -> URL path segment
en_US: en
de: de
ContentRepositoryRegistry:
contentRepositories:
default:
contentDimensions:
language:
label: 'Language'
icon: language
values:
'en_US':
label: English (US)
'de':
label: Deutsch
I need a language switcher, but I cannot get dynamic values for vars: currentLanguage and languages in DistributionPackages/Custom.Site/Resources/Private/Fusion/Component/Template/Header/Header.fusion
I tried currentLanguage = ${Neos.Dimension.currentValue(site, ‘language’)}, languages = ${Neos.Dimension.allDimensionValues(site, ‘language’)}. But still vars were empty.
Hi can you please show the var_dump output of those helpers and just to be safe the site node as well so we can see what is its real $dimensionSpacePoint.
For debugging there is either Neos.Fusion:Debug or just write or hack an EEL helper to do \Neos\Flow\var_dump($value); die();
prototype(Custom.Site:Component.Template.Header) < prototype(Neos.Fusion:Component) {
menu = ‘’
# All languages
languages = Neos.Neos:DimensionsMenuItems {
node = ${site} # site node works
dimension = 'language'
}
# Current language from site
currentLanguage = ${site.activeDimensions.language[0].value}
What does this helper return? If its not the desired output could you please show us the value of site.dimensionSpacePoint and site.originDimensionSpacePoint
I changed prototype(Custom.Site:Component.Template.Header) < prototype(Neos.Fusion:Component) {
to prototype(Custom.Site:Content.Menu) < prototype(Neos.Neos:ContentComponent) {
and wrote as you mentioned currentLanguage = ${Neos.Dimension.currentValue(site, 'language')}and now instead null I get what I need