interface ContentDimensionPresetSourceInterface implements ContentDimensionPresetSourceInterface (View source)

An interface for a Content Dimension Preset source

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.

Methods

array
getAllPresets()

Get the full presets configuration as an array

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.

array
findPresetByUriSegment(string $dimensionName, string $uriSegment)

Find a dimension preset by URI identifier

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'

Return Value

array

Presets configuration, indexed by dimension identifier

array getDefaultPreset(string $dimensionName)

Get the default preset of a dimension

Parameters

string $dimensionName

The dimension name where the default preset should be returned

Return Value

array

The preset configuration, including the identifier as key "identifier"

array findPresetByDimensionValues(string $dimensionName, array $dimensionValues)

Find a dimension preset by dimension values

Parameters

string $dimensionName
array $dimensionValues

Return Value

array

The preset configuration, including the identifier as key "identifier" or NULL if none was found

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.

Parameters

string $dimensionName

Name of the dimension to return presets for

array $preselectedDimensionPresets

An array of dimension name and preset identifier specifying the presets which are already selected

Return Value

array

An array of presets only for the dimension specified in $dimensionName. Structure is: array($dimensionName => array('presets' => array(...))

bool isPresetCombinationAllowedByConstraints(array $dimensionsNamesAndPresetIdentifiers)

Checks if the given combination of presets is allowed, according to possibly defined constraints in the content dimension configuration.

Parameters

array $dimensionsNamesAndPresetIdentifiers

Preset pairs, for example array('language' => 'de', 'country' => 'GER', 'persona' => 'clueless')

Return Value

bool

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.

Parameters

array $targetValues

Return Value

array

array findPresetByUriSegment(string $dimensionName, string $uriSegment)

Find a dimension preset by URI identifier

Parameters

string $dimensionName

The dimension name where the preset should be searched

string $uriSegment

The URI segment for a Content Dimension Preset

Return Value

array

The preset configuration, including the identifier as key "identifier" or NULL if none was found