SelectItemProcessor

final class \TYPO3\CMS\Backend\Form\Processor\SelectItemProcessor

Provides shared select item related utility functions.

Tags

todo

Move additional shareable code from form-engine into here.

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Methods

__construct()  : mixed
groupAndSortItems()  : array
Is used when --div-- elements in the item list are used, or if groups are defined via "groupItems" config array.
transformArrayToSelectItems()  : SelectItem[]
transformSelectItemsToArray()  : array

Methods

groupAndSortItems()

Is used when --div-- elements in the item list are used, or if groups are defined via "groupItems" config array.

public groupAndSortItems(array $allItems, array $definedGroups, array $sortOrders) : array

This method takes the --div-- elements out of the list, and adds them to the group lists.

A main "none" group is added, which is always on top, when items are not set to be in a group. All items without a groupId - which is defined by the fourth key of an item in the item array - are added to the "none" group, or to the last group used previously, to ensure ordering as much as possible as before.

Then the found groups are iterated over the order in the [itemGroups] list, and items within a group can be sorted via "sortOrders" configuration.

All grouped items are then "flattened" out and --div-- items are added for each group to keep backwards-compatibility.

Parameters

$allItems : array

all resolved items including the ones from foreign_table values. The group ID information can be found in key ['group'] of an item.

$definedGroups : array

[config][itemGroups]

$sortOrders : array

[config][sortOrders]

Return values

array

transformArrayToSelectItems()

public transformArrayToSelectItems(array $items[, string $type = 'select' ]) : SelectItem[]

Parameters

$items : array
$type : string = 'select'

Return values

SelectItem[]

transformSelectItemsToArray()

public transformSelectItemsToArray(array $items) : array

Parameters

$items : array

Return values

array
On this page