Neos.Neos/Classes/Routing/FrontendNodeRoutePartHandler.php
protected function getUriSegmentForDimensions(array $dimensionsValues, $currentNodeIsSiteNode)
    {
        $uriSegment = '';
        $allDimensionPresetsAreDefault = true;

        foreach ($this->contentDimensionPresetSource->getAllPresets() as $dimensionName => $dimensionPresets) {
            $preset = null;
            if (isset($dimensionsValues[$dimensionName])) {
                $preset = $this->contentDimensionPresetSource->findPresetByDimensionValues($dimensionName, $dimensionsValues[$dimensionName]);
            }
            $defaultPreset = $this->contentDimensionPresetSource->getDefaultPreset($dimensionName);
            if ($preset === null) {
                $preset = $defaultPreset;
            }
            if ($preset !== $defaultPreset) {
                $allDimensionPresetsAreDefault = false;
            }
            if (!isset($preset['uriSegment'])) {
                throw new \Exception(sprintf('No "uriSegment" configured for content dimension preset "%s" for dimension "%s". Please check the content dimension configuration in Settings.yaml', $preset['identifier'], $dimensionName), 1395824520);
            }
            $uriSegment .= $preset['uriSegment'] . '_';
        }

        if ($this->supportEmptySegmentForDimensions && $allDimensionPresetsAreDefault && $currentNodeIsSiteNode) {
            return '/';
        } else {
            return ltrim(trim($uriSegment, '_') . '/', '/');
        }
    }
protected function getUriSegmentForDimensions(array $dimensionsValues, $currentNodeIsSiteNode)
    {
        $uriSegment = '';
        $allDimensionPresetsAreDefault = true;

        foreach ($this->contentDimensionPresetSource->getAllPresets() as $dimensionName => $dimensionPresets) {
            $preset = null;
            if (isset($dimensionsValues[$dimensionName])) {
                $preset = $this->contentDimensionPresetSource->findPresetByDimensionValues($dimensionName, $dimensionsValues[$dimensionName]);
            }
            $defaultPreset = $this->contentDimensionPresetSource->getDefaultPreset($dimensionName);
            if ($preset === null) {
                $preset = $defaultPreset;
            }
            if ($preset !== $defaultPreset) {
                $allDimensionPresetsAreDefault = false;
            }
            if (!isset($preset['uriSegment'])) {
                throw new \Exception(sprintf('No "uriSegment" configured for content dimension preset "%s" for dimension "%s". Please check the content dimension configuration in Settings.yaml', $preset['identifier'], $dimensionName), 1395824520);
            }
            $uriSegment .= $preset['uriSegment'] . '_';
        }

        if ($this->supportEmptySegmentForDimensions && $allDimensionPresetsAreDefault && $currentNodeIsSiteNode) {
            return '/';
        } else {
            return ltrim(trim($uriSegment, '_') . '/', '/');
        }
    }
protected function getUriSegmentForDimensions ( array $ dimensionsValues , $ currentNodeIsSiteNode ) { $ uriSegment = '' ; $ allDimensionPresetsAreDefault = true ; foreach ( $ this -> contentDimensionPresetSource -> getAllPresets ( ) as $ dimensionName => $ dimensionPresets ) { $ preset = null ; if ( isset ( $ dimensionsValues [ $ dimensionName ] ) ) { $ preset = $ this -> contentDimensionPresetSource -> findPresetByDimensionValues ( $ dimensionName , $ dimensionsValues [ $ dimensionName ] ) ; } $ defaultPreset = $ this -> contentDimensionPresetSource -> getDefaultPreset ( $ dimensionName ) ; if ( $ preset === null ) { $ preset = $ defaultPreset ; } if ( $ preset !== $ defaultPreset ) { $ allDimensionPresetsAreDefault = false ; } if ( ! isset ( $ preset [ 'uriSegment' ] ) ) { throw new \ Exception ( sprintf ( 'No "uriSegment" configured for content dimension preset "%s" for dimension "%s". Please check the content dimension configuration in Settings.yaml' , $ preset [ 'identifier' ] , $ dimensionName ) , 1395824520 ) ; } $ uriSegment .= $ preset [ 'uriSegment' ] . '_' ; } if ( $ this -> supportEmptySegmentForDimensions && $ allDimensionPresetsAreDefault && $ currentNodeIsSiteNode ) { return '/' ; } else { return ltrim ( trim ( $ uriSegment , '_' ) . '/' , '/' ) ; } }
Find a URI segment in the content dimension presets for the given "language" dimension values

This will do a reverse lookup from actual dimension values to a preset and fall back to the default preset if none
can be found.

@param array $dimensionsValues An array of dimensions and their values, indexed by dimension name
@param boolean $currentNodeIsSiteNode If the current node is actually the site node
@return string
@throws \Exception
Find a URI segment in the content dimension presets for the given language dimension values