Neos\Neos\Controller\Service\ContentDimensionsController::showAction PHP 메소드

showAction() 공개 메소드

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".
public showAction ( string $dimensionName, array $chosenDimensionPresets = [] ) : void
$dimensionName string Name of the dimension to return presets for
$chosenDimensionPresets array An optional array of dimension names and a single preset per dimension
리턴 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);
        }
    }
ContentDimensionsController