SingleFieldContainer

class \TYPO3\CMS\Backend\Form\Container\SingleFieldContainer

Extends
AbstractContainer

Container around a "single field".

This container is the last one in the chain before processing is handed over to single element classes. If a single field is of type flex or inline, it however creates FlexFormEntryContainer or InlineControlContainer.

The container does various checks and processing for a given single fields.

Table of Contents

Properties

$data  : array
Main data array to work on, given from parent to child elements
$defaultFieldControl  : array
A list of default field controls added to the element / container.
$defaultFieldInformation  : array
A list of default field information added to the element / container.
$defaultFieldWizard  : array
A list of default field wizards added to the element / container.
$nodeFactory  : NodeFactory
Instance of the node factory to create sub elements, container and single element expansions.

Methods

__construct()  : mixed
Set data to data array and register node factory to render sub elements
render()  : array
Entry method
arrayCompareComplex()  : bool
Handles complex comparison requests on an array.
explodeSingleFieldShowItemConfiguration()  : array
A single field of TCA 'types' 'showitem' can have three semicolon separated configuration options: fieldName: Name of the field to be found in TCA 'columns' section fieldLabel: An alternative field label paletteName: Name of a palette to be found in TCA 'palettes' section that is rendered after this field
getBackendUserAuthentication()  : BackendUserAuthentication
getLanguageService()  : LanguageService
getValidationDataAsJsonString()  : string
Build JSON string for validations rules.
initializeResultArray()  : array
Initialize the array that is returned to parent after calling. This structure is identical for *all* nodes. Parent will merge the return of a child with its own stuff and in itself return an array of the same structure.
inlineFieldShouldBeSkipped()  : bool
Rendering of inline fields should be skipped under certain circumstances
isAssociativeArray()  : bool
Checks whether an object is an associative array.
isInlineChildAndLabelField()  : bool
Checks if the $table is the child of an inline type AND the $field is the label field of this table.
mergeChildReturnIntoExistingResult()  : array
Merge existing data with a child return array.
renderFieldControl()  : array
Merge field control configuration with default controls and render them.
renderFieldInformation()  : array
Merge field information configuration with default and render them.
renderFieldWizard()  : array
Merge field wizard configuration with default wizards and render them.
renderTabMenu()  : string
Render tabs with label and content. Used by TabsContainer and FlexFormTabsContainer.

Properties

$data

Main data array to work on, given from parent to child elements

protected array $data = []

$defaultFieldControl

A list of default field controls added to the element / container.

protected array $defaultFieldControl = []

This property is often reset by single elements.

$defaultFieldInformation

A list of default field information added to the element / container.

protected array $defaultFieldInformation = []

$defaultFieldWizard

A list of default field wizards added to the element / container.

protected array $defaultFieldWizard = []

This property is often reset by single elements.

$nodeFactory

Instance of the node factory to create sub elements, container and single element expansions.

Deprecated

since TYPO3 v12.4. will be removed in TYPO3 v13.0.

protected NodeFactory $nodeFactory

Methods

__construct()

Set data to data array and register node factory to render sub elements

public __construct([NodeFactory|null $nodeFactory = null ][, array $data = [] ]) : mixed

Deprecated

since TYPO3 v12.4. Default constructor will be removed in v13.

Parameters

$nodeFactory : NodeFactory|null = null
$data : array = []

render()

Entry method

public render() : array

Tags

throws
InvalidArgumentException

Return values

array —

As defined in initializeResultArray() of AbstractNode

arrayCompareComplex()

Handles complex comparison requests on an array.

protected arrayCompareComplex(array $subjectArray, array $searchArray[, string $type = '' ]) : bool

A request could look like the following:

$searchArray = array( '%AND' => array( 'key1' => 'value1', 'key2' => 'value2', '%OR' => array( 'subarray' => array( 'subkey' => 'subvalue' ), 'key3' => 'value3', 'key4' => 'value4' ) ) );

It is possible to use the array keys '%AND.1', '%AND.2', etc. to prevent overwriting the sub-array. It could be necessary, if you use complex comparisons.

The example above means, key1 AND key2 (and their values) have to match with the $subjectArray and additional one OR key3 or key4 have to meet the same condition. It is also possible to compare parts of a sub-array (e.g. "subarray"), so this function recurses down one level in that sub-array.

Parameters

$subjectArray : array

The array to search in

$searchArray : array

The array with keys and values to search for

$type : string = ''

Use '%AND' or '%OR' for comparison

Return values

bool —

The result of the comparison

explodeSingleFieldShowItemConfiguration()

A single field of TCA 'types' 'showitem' can have three semicolon separated configuration options: fieldName: Name of the field to be found in TCA 'columns' section fieldLabel: An alternative field label paletteName: Name of a palette to be found in TCA 'palettes' section that is rendered after this field

protected explodeSingleFieldShowItemConfiguration(string $field) : array

Parameters

$field : string

Semicolon separated field configuration

Tags

throws
RuntimeException

Return values

array

getValidationDataAsJsonString()

Build JSON string for validations rules.

protected getValidationDataAsJsonString(array $config) : string

Parameters

$config : array

Return values

string

initializeResultArray()

Initialize the array that is returned to parent after calling. This structure is identical for *all* nodes. Parent will merge the return of a child with its own stuff and in itself return an array of the same structure.

protected initializeResultArray() : array

Return values

array

inlineFieldShouldBeSkipped()

Rendering of inline fields should be skipped under certain circumstances

protected inlineFieldShouldBeSkipped() : bool

Return values

bool —

TRUE if field should be skipped based on inline configuration

isAssociativeArray()

Checks whether an object is an associative array.

protected isAssociativeArray(mixed $object) : bool

Parameters

$object : mixed

The object to be checked

Return values

bool —

Returns TRUE, if the object is an associative array

isInlineChildAndLabelField()

Checks if the $table is the child of an inline type AND the $field is the label field of this table.

protected isInlineChildAndLabelField(string $table, string $field) : bool

This function is used to dynamically update the label while editing. This has no effect on labels, that were processed by a FormEngine-hook on saving.

Parameters

$table : string

The table to check

$field : string

The field on this table to check

Return values

bool —

Is inline child and field is responsible for the label

mergeChildReturnIntoExistingResult()

Merge existing data with a child return array.

protected mergeChildReturnIntoExistingResult(array $existing, array $childReturn[, bool $mergeHtml = true ]) : array

The incoming $childReturn array should be initialized using initializeResultArray() beforehand.

Parameters

$existing : array

Currently merged array

$childReturn : array

Array returned by child

$mergeHtml : bool = true

If false, the ['html'] section of $childReturn will NOT be added to $existing

Return values

array —

Result array

renderFieldControl()

Merge field control configuration with default controls and render them.

protected renderFieldControl() : array

Return values

array —

Result array

renderFieldInformation()

Merge field information configuration with default and render them.

protected renderFieldInformation() : array

Return values

array —

Result array

renderFieldWizard()

Merge field wizard configuration with default wizards and render them.

protected renderFieldWizard() : array

Return values

array —

Result array

renderTabMenu()

Render tabs with label and content. Used by TabsContainer and FlexFormTabsContainer.

protected renderTabMenu(array $menuItems, string $domId[, int $defaultTabIndex = 1 ]) : string

Re-uses the template Tabs.html which is also used by ModuleTemplate.php.

Parameters

$menuItems : array

Tab elements, each element is an array with "label" and "content"

$domId : string

DOM id attribute, will be appended with an iteration number per tab.

$defaultTabIndex : int = 1

Return values

string
On this page