TcaFlexProcess implements FormDataProviderInterface
Process data structures and data values, calculate defaults.
This is typically the last provider, executed after TcaFlexPrepare
Table of Contents
Interfaces
- FormDataProviderInterface
- Interface must be implemented by form data provider classes.
Methods
- addData() : array<string|int, mixed>
- Determine possible pageTsConfig overrides and apply them to ds.
- getBackendUser() : BackendUserAuthentication
- getPageTsOfFlex() : array<string|int, mixed>
- Determine TCEFORM.aTable.aField.matchingIdentifier
- getSimplifiedDataStructureIdentifier() : string
- Calculate a simplified (and wrong) data structure identifier.
- modifyDataStructureAndDataValuesByFlexFormSegmentGroup() : array<string|int, mixed>
- Feed single flex field and data to FlexFormSegment FormData compiler and merge result.
- modifyOuterDataStructure() : array<string|int, mixed>
- Handle "outer" flex data structure changes like language and sheet description. Does not change "TCA" or values of single elements
- modifySingleSheetInformation() : array<string|int, mixed>
- Modify data structure of a single "sheet" Sets "secondary" data like sheet names and so on, but does NOT modify single elements
- prepareNewSectionContainer() : array<string|int, mixed>
- Prepare data structure and data values for a new section container.
- removeDisabledFieldsFromDataStructure() : array<string|int, mixed>
- Remove fields from data structure that are disabled in pageTsConfig.
- removeExcludeFieldsFromDataStructure() : array<string|int, mixed>
- Removes fields from data structure the user has no access to
- scanForInvalidSectionContainerTca() : mixed
- Some TCA combinations like inline or nesting a section into a section container is not supported and throws exceptions.
Methods
addData()
Determine possible pageTsConfig overrides and apply them to ds.
public
addData(array<string|int, mixed> $result) : array<string|int, mixed>
Determine available languages and sanitize ds for further processing. Then kick and validate further details like excluded fields. Finally for each possible value and ds, call FormDataCompiler with set FlexFormSegment group to resolve single field stuff like item processor functions.
Parameters
- $result : array<string|int, mixed>
-
Initialized result array
Tags
Return values
array<string|int, mixed>getBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetPageTsOfFlex()
Determine TCEFORM.aTable.aField.matchingIdentifier
protected
getPageTsOfFlex(array<string|int, mixed> $result, string $fieldName, string $flexIdentifier) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>
-
Result array
- $fieldName : string
-
Handled field name
- $flexIdentifier : string
-
Determined identifier
Return values
array<string|int, mixed> —Page TSconfig for this flex
getSimplifiedDataStructureIdentifier()
Calculate a simplified (and wrong) data structure identifier.
protected
getSimplifiedDataStructureIdentifier(string $dataStructureIdentifier) : string
This is used to find pageTsConfig options of flex fields and exclude field definitions later, see methods below. If the data structure identifier is not type=tca based and if dataStructureKey is not as expected, fallback is "default"
Example pi_flexform with ext:news in tt_content:
- TCA config of pi_flexform ds_pointerfield is set to "list_type,CType"
- list_type in databaseRow is "news_pi1"
- CType in databaseRow is "list"
- The resulting dataStructureIdentifier calculated by FlexFormTools is then: {"type":"tca","tableName":"tt_content","fieldName":"pi_flexform","dataStructureKey":"news_pi1,list"}
- The resulting simpleDataStructureIdentifier is "news_pi1"
- The pageTsConfig base path used for flex field overrides is "TCEFORM.tt_content.pi_flexform.news_pi1", a full example path disabling a field: "TCEFORM.tt_content.pi_flexform.news_pi1.sDEF.settings.orderBy.disabled = 1"
- The exclude path for be_user exclude rights is "tt_content:pi_flexform;news_pi1", a full example: tt_content:pi_flexform;news_pi1;sDEF;settings.orderBy
Notes: This approach is obviously limited. It is not possible to override flex form DS via pageTsConfig for other complex or dynamically created data structure definitions. And worse, the fallback to "default" may lead to naming clashes if two different data structures have identical sheet and field names. Also, the exclude field handling is limited and it is not possible to respect 'exclude' fields in flex form data structures if the dataStructureIdentifier is based on type="record" or manipulated by a hook in FlexFormTools. All that can only be solved by changing the pageTsConfig syntax referencing flex fields, probably by involving the whole data structure identifier and going away from this "simple" approach. For exclude fields there is the additional issue that the special="exclude" code is based on guess work, to find possible data structures. If this area here is changed and a pageTsConfig syntax change is raised, it would probably be a good idea to solve the access restrictions area at the same time - see the related methods that deal with flex field handling for special="exclude" for more comments on this. Another limitation is that the current syntax in both pageTsConfig and exclude fields does not consider flex form section containers at all.
Parameters
- $dataStructureIdentifier : string
Return values
stringmodifyDataStructureAndDataValuesByFlexFormSegmentGroup()
Feed single flex field and data to FlexFormSegment FormData compiler and merge result.
protected
modifyDataStructureAndDataValuesByFlexFormSegmentGroup(array<string|int, mixed> $result, string $fieldName, array<string|int, mixed> $pageTsConfig) : array<string|int, mixed>
This one is nasty. Goal is to have processed TCA stuff in DS and also have validated / processed data values.
Two main parts in this method:
- Process values and TCA of existing section containers
- Process TCA of "normal" fields
Parameters
- $result : array<string|int, mixed>
-
Result array
- $fieldName : string
-
Current handle field name
- $pageTsConfig : array<string|int, mixed>
-
Given pageTsConfig of this flex form
Tags
Return values
array<string|int, mixed> —Modified item array
modifyOuterDataStructure()
Handle "outer" flex data structure changes like language and sheet description. Does not change "TCA" or values of single elements
protected
modifyOuterDataStructure(array<string|int, mixed> $result, string $fieldName, array<string|int, mixed> $pageTsConfig) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>
-
Result array
- $fieldName : string
-
Current handle field name
- $pageTsConfig : array<string|int, mixed>
-
Given pageTsConfig of this flex form
Return values
array<string|int, mixed> —Modified item array
modifySingleSheetInformation()
Modify data structure of a single "sheet" Sets "secondary" data like sheet names and so on, but does NOT modify single elements
protected
modifySingleSheetInformation(array<string|int, mixed> $dataStructure, array<string|int, mixed> $pageTsOfSheet) : array<string|int, mixed>
Parameters
- $dataStructure : array<string|int, mixed>
-
Given data structure
- $pageTsOfSheet : array<string|int, mixed>
-
Page Ts config of given field
Return values
array<string|int, mixed> —Modified data structure
prepareNewSectionContainer()
Prepare data structure and data values for a new section container.
protected
prepareNewSectionContainer(array<string|int, mixed> $result, string $fieldName) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>
-
Incoming result array
- $fieldName : string
-
The field name with this flex form
Return values
array<string|int, mixed> —Modified result
removeDisabledFieldsFromDataStructure()
Remove fields from data structure that are disabled in pageTsConfig.
protected
removeDisabledFieldsFromDataStructure(array<string|int, mixed> $result, string $fieldName, array<string|int, mixed> $pageTsConfig) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>
-
Result array
- $fieldName : string
-
Current handle field name
- $pageTsConfig : array<string|int, mixed>
-
Given pageTsConfig of this flex form
Return values
array<string|int, mixed> —Modified item array
removeExcludeFieldsFromDataStructure()
Removes fields from data structure the user has no access to
protected
removeExcludeFieldsFromDataStructure(array<string|int, mixed> $result, string $fieldName, string $flexIdentifier) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>
-
Result array
- $fieldName : string
-
Current handle field name
- $flexIdentifier : string
-
Determined identifier
Return values
array<string|int, mixed> —Modified result
scanForInvalidSectionContainerTca()
Some TCA combinations like inline or nesting a section into a section container is not supported and throws exceptions.
protected
scanForInvalidSectionContainerTca(array<string|int, mixed> $result, string $fieldName) : mixed
Parameters
- $result : array<string|int, mixed>
-
Result array
- $fieldName : string
-
Handled field name