It allows to resolve a Content Dimension Preset for a given dimension and urlSegment or find a matching preset for a list of dimension values. Content Dimension Preset ======================== A Content Dimension Preset assigns an identifier to a list of dimension values. It has UI properties for a label and icon and further options for routing. The default implementation ConfigurationContentDimensionPresetSource will read the available presets from settings.
Inheritance: extends Neos\ContentRepository\Domain\Service\ContentDimensionPresetSourceInterface
 /**
  * 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
  */
 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 ($allDimensionPresetsAreDefault && $currentNodeIsSiteNode) {
         return '/';
     } else {
         return ltrim(trim($uriSegment, '_') . '/', '/');
     }
 }
 /**
  * Returns only presets of the dimension specified by $dimensionName. But even though only one dimension is returned,
  * the output follows the structure as described in ContentDimensionPresetSourceInterface::getAllPresets().
  *
  * It is possible to pass a selection of presets as a filter. In that case, $chosenDimensionPresets must be an array
  * of one or more dimension names (key) and preset names (value). The returned list will then only contain dimension
  * presets which are allowed in combination with the given presets.
  *
  * Example: Given that $chosenDimensionPresets = array('country' => 'US') and that a second dimension "language"
  * exists and $dimensionName is "language. This method will now display a list of dimension presets for the dimension
  * "language" which are allowed in combination with the country "US".
  *
  * @param string $dimensionName Name of the dimension to return presets for
  * @param array $chosenDimensionPresets An optional array of dimension names and a single preset per dimension
  * @return void
  */
 public function showAction($dimensionName, $chosenDimensionPresets = array())
 {
     if ($chosenDimensionPresets === array()) {
         $contentDimensionsAndPresets = $this->contentDimensionPresetSource->getAllPresets();
         if (!isset($contentDimensionsAndPresets[$dimensionName])) {
             $this->throwStatus(404, sprintf('The dimension %s does not exist.', $dimensionName));
         }
         $contentDimensionsAndPresets = array($dimensionName => $contentDimensionsAndPresets[$dimensionName]);
     } else {
         $contentDimensionsAndPresets = $this->contentDimensionPresetSource->getAllowedDimensionPresetsAccordingToPreselection($dimensionName, $chosenDimensionPresets);
     }
     if ($this->view instanceof JsonView) {
         $this->view->assign('value', $contentDimensionsAndPresets);
     } else {
         $this->view->assign('dimensionName', $dimensionName);
         $this->view->assign('contentDimensionsPresets', $contentDimensionsAndPresets);
     }
 }
 /**
  * Get Related Nodes for an asset
  *
  * @param AssetInterface $asset
  * @return void
  */
 public function relatedNodesAction(AssetInterface $asset)
 {
     $userWorkspace = $this->userService->getPersonalWorkspace();
     $usageReferences = $this->assetService->getUsageReferences($asset);
     $relatedNodes = [];
     /** @var AssetUsageInNodeProperties $usage */
     foreach ($usageReferences as $usage) {
         $documentNodeIdentifier = $usage->getDocumentNode() instanceof NodeInterface ? $usage->getDocumentNode()->getIdentifier() : null;
         $relatedNodes[$usage->getSite()->getNodeName()]['site'] = $usage->getSite();
         $relatedNodes[$usage->getSite()->getNodeName()]['documentNodes'][$documentNodeIdentifier]['node'] = $usage->getDocumentNode();
         $relatedNodes[$usage->getSite()->getNodeName()]['documentNodes'][$documentNodeIdentifier]['nodes'][] = ['node' => $usage->getNode(), 'nodeData' => $usage->getNode()->getNodeData(), 'contextDocumentNode' => $usage->getDocumentNode(), 'accessible' => $usage->isAccessible()];
     }
     $this->view->assignMultiple(['asset' => $asset, 'relatedNodes' => $relatedNodes, 'contentDimensions' => $this->contentDimensionPresetSource->getAllPresets(), 'userWorkspace' => $userWorkspace]);
 }
 /**
  * @param Workspace $workspace
  * @return void
  */
 public function showAction(Workspace $workspace)
 {
     $this->view->assignMultiple(['selectedWorkspace' => $workspace, 'selectedWorkspaceLabel' => $workspace->getTitle() ?: $workspace->getName(), 'baseWorkspaceName' => $workspace->getBaseWorkspace()->getName(), 'baseWorkspaceLabel' => $workspace->getBaseWorkspace()->getTitle() ?: $workspace->getBaseWorkspace()->getName(), 'canPublishToBaseWorkspace' => $this->userService->currentUserCanPublishToWorkspace($workspace->getBaseWorkspace()), 'siteChanges' => $this->computeSiteChanges($workspace), 'contentDimensions' => $this->contentDimensionPresetSource->getAllPresets()]);
 }