Class LegacyPalettesParser.

This class parses the palettes from a legacy DCA into the palette collection definitions being used in DcGeneral.

 Methods

Parse the palette selector and create the corresponding condition.

createPaletteCondition(string $paletteSelector, array $selectorFieldNames) : null | \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\Condition\Palette\PaletteConditionInterface

Parameters

$paletteSelector

string

Create the condition for the selector.

$selectorFieldNames

array

The property names to be used as selectors.

Returns

Parse the sub palette selector and create the corresponding condition.

createSubpaletteCondition(string $subPaletteSelector, array $selectorFieldNames) : \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\Condition\Property\PropertyTrueCondition | \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\Condition\Property\PropertyValueCondition | null
This method supports the following cases for the sub palette selector: Case 1: the sub palette selector contain a combination of "property name" + '_' + value in which we require that the "property name" is contained within $selectorFieldNames. In this cases a select/radio sub palette is in place. Case 2: the sub palette selector is only a "property name", the value is then implicated to be true. In this cases a checkbox sub palette is in place.

Parameters

$subPaletteSelector

string

The selector being evaluated.

$selectorFieldNames

array

The names of the properties to be used as selectors [optional].

Returns

Translate a sub palette selector into the real name of a property.

createSubpaletteSelectorFieldName(string $subPaletteSelector, array $selectorFieldNames) : string
This method supports the following cases for the sub palette selector: Case 1: the sub palette selector contain a combination of "property name" + '_' + value in which we require that the "property name" is contained within $selectorFieldNames. In this cases a select/radio sub palette is in place. Case 2: the sub palette selector is only a "property name", the value is then implicated to be true. In this cases a checkbox sub palette is in place.

Parameters

$subPaletteSelector

string

The selector being evaluated.

$selectorFieldNames

array

The names of the properties to be used as selectors [optional].

Returns

string

Parse the palette and sub palette array and create a complete palette collection.

parse(array $palettes, array $subpalettes, \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteCollectionInterface|null $collection) : \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteCollectionInterface

Parse a single palette.

parsePalette(string $paletteSelector, string $fields, array $subPaletteProperties, \ContaoCommunityAlliance\DcGeneral\Contao\Dca\Palette\array(string) $selectorFieldNames, \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface $palette) : \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\Palette

Parameters

$paletteSelector

string

The selector for the palette.

$fields

string

The fields contained within the palette.

$subPaletteProperties

$selectorFieldNames

\ContaoCommunityAlliance\DcGeneral\Contao\Dca\Palette\array(string)

The names of all properties being used as selectors [optional].

$palette

\ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteInterface

The palette to be populated [optional].

Returns

Parse the given palettes.

parsePalettes(array $palettes, array $subPaletteProperties, array $selectorFieldNames, \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteCollectionInterface $collection) : \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteCollectionInterface

Parameters

$palettes

$subPaletteProperties

$selectorFieldNames

array

List of names of the properties to be used as selector [optional].

$collection

\ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PaletteCollectionInterface

The palette collection to populate [optional].

Returns

Parse the list of sub palette fields into an array of properties.

parseSubpalette(string $subPaletteSelector, string $childFields, array $selectorFieldNames) : \ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PropertyInterface[]

Parameters

$subPaletteSelector

string

The selector in use.

$childFields

string

List of the properties for the sub palette.

$selectorFieldNames

array

List of the selector properties [optional].

Returns

Parse the sub palettes and return the properties for each selector property.

parseSubpalettes(array $subpalettes, array $selectorFieldNames) : \ContaoCommunityAlliance\DcGeneral\Contao\Dca\Palette\array(string

Parameters

$subpalettes

array

The sub palettes to parse.

$selectorFieldNames

array

Names of the selector properties [optional].

Returns