Skip to content

Commit

Permalink
Merge pull request #4859 from dlubitz/bugfix/dimension-value-independent
Browse files Browse the repository at this point in the history
BUGFIX: Allow dimension preset keys to be different from values for DimensionsMenu
  • Loading branch information
dlubitz committed Feb 23, 2024
2 parents 3a0a0e7 + 7cfe27a commit 56841ac
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function buildItems()

foreach ($this->contentDimensionCombinator->getAllAllowedCombinations() as $allowedCombination) {
$targetDimensions = $this->calculateTargetDimensionsForCombination($allowedCombination);

$presets = $this->configurationContentDimensionPresetSource->findPresetsByTargetValues($allowedCombination);
if ($pinnedDimensionName !== null && is_array($pinnedDimensionValues)) {
if (!in_array($targetDimensions[$pinnedDimensionName], $pinnedDimensionValues)) {
continue;
Expand Down Expand Up @@ -105,13 +105,13 @@ protected function buildItems()
}

// determine metadata for target dimensions of node
array_walk($targetDimensions, static function (&$dimensionValue, $dimensionName, $allDimensionPresets) use ($pinnedDimensionName) {
array_walk($targetDimensions, static function (&$dimensionValue, $dimensionName) use ($pinnedDimensionName, $presets) {
$dimensionValue = [
'value' => $dimensionValue,
'label' => $allDimensionPresets[$dimensionName]['presets'][$dimensionValue]['label'],
'label' => $presets[$dimensionName]['label'],
'isPinnedDimension' => $pinnedDimensionName === null || $dimensionName == $pinnedDimensionName
];
}, $allDimensionPresets);
});

$menuItems[] = [
'node' => $nodeInDimensions,
Expand Down

0 comments on commit 56841ac

Please sign in to comment.