ContentDimensionPresetSourceInterface
interface ContentDimensionPresetSourceInterface (View source)
An interface for a Content Dimension Preset source
It allows to find a matching preset for a list of dimension values. Or calculate all dimension combinations for you (the matrix of all configured presets).
Content Dimension Preset
A Content Dimension Preset assigns an identifier to a (fallback) list of dimension values. It can have additional properties like UI label and icon and further options for routing if needed.
The default implementation ConfigurationContentDimensionPresetSource will read the available presets from settings.
Methods
Get the full presets configuration as an array
Get the default preset of a dimension
Find a dimension preset by dimension values
Returns a list of presets of the specified dimension which are allowed in combination with the given presets of other dimensions.
Checks if the given combination of presets is allowed, according to possibly defined constraints in the content dimension configuration.
Finds for each configured dimension the best matching preset based on given target value for that dimension.
Details
array
getAllPresets()
Get the full presets configuration as an array
Example:
'language': defaultPreset: 'all' label: 'Language' icon: 'icon-language' presets: 'all': label: 'All languages' values: ['mul_ZZ'] uriSegment: 'intl' 'de_DE': label: 'Deutsch (Deutschland)' values: ['de_DE', 'de_ZZ', 'mul_ZZ'] uriSegment: 'deutsch'
array
getDefaultPreset(string $dimensionName)
Get the default preset of a dimension
array
findPresetByDimensionValues(string $dimensionName, array $dimensionValues)
Find a dimension preset by dimension values
array
getAllowedDimensionPresetsAccordingToPreselection(string $dimensionName, array $preselectedDimensionPresets)
Returns a list of presets of the specified dimension which are allowed in combination with the given presets of other dimensions.
bool
isPresetCombinationAllowedByConstraints(array $dimensionsNamesAndPresetIdentifiers)
Checks if the given combination of presets is allowed, according to possibly defined constraints in the content dimension configuration.
array
findPresetsByTargetValues(array $targetValues)
Finds for each configured dimension the best matching preset based on given target value for that dimension.
The $targetValues array should have the dimension as key and the target value (single value) as value.