TcaPreparation
readonly class \
Prepare TCA. Used in bootstrap and Flex Form Data Structures, executed *after* TcaMigration.
This is used to add internal TCA details needed by core. For instance, type=category fields receive all the relation details in order to work properly.
Internal
Class and API may change any time.
Table of Contents
Methods
- prepare() : array
- Prepare TCA
- addIgnoredPageTypeRestrictionRecords() : array
- addSystemFieldsToShowitemTypes() : array
- Ensure that all system fields (CType, colPos, hidden etc.) are automatically added to the showitem list of all CTypes in tt_content. As custom CTypes might have added the fields, the respective fields also need to be removed first.
- configureAllowedDisallowedFileExtensions() : array
- configureFileReferences() helper
- configureAllowedDisallowedInOverrideChildTca() : array
- configureFileReferences() helper
- configureAncestorReferenceForMonoglotChildren() : array
- A language-aware table synchronizing an inline or file field to its translations ("l10n_mode" => "exclude" or "allowLanguageSynchronization") gives each translation copies of the children. If the child table is not language-aware, the copies can only be found again through the "origUid" of the child table, which is enforced here.
- configureCategoryRelations() : array
- Prepares TCA configuration of type='category' fields.
- configureEmailSoftReferences() : array
- Add "'softref' = 'email[subst]'" to all 'type' = 'email' column fields.
- configureFileReferences() : array
- configureLinkSoftReferences() : array
- Add "'softref' = 'typolink'" to all 'type' = 'link' column fields.
- configureRelationshipToOne() : array
- Add "'maxitems' => 1" to all relation type column fields with 'relationship' set to 'oneToOne' or 'manyToOne'.
- configureSelectSingle() : array
- Add "'relationship' for TCA type "select" fields, having "selectSingle" set as renderType and are pointing to a "foreign_table". Depending on further configuration, this will set the "relationship" to either "manyToMany" (in case "MM" is set) or to "manyToOne".
- prepareFileExtensions() : string
- configureFileReferences() helper: Ensures format, replaces placeholders and remove duplicates
Methods
prepare()
Prepare TCA
public
prepare(array $tca[, bool $isFlexForm = false ]) : array
This class is typically called within bootstrap with empty caches after all TCA files from extensions have been loaded. The preparation is then applied and the prepared result is cached. For flex form TCA, this class is called dynamically if opening a record in the backend.
See unit tests for details.
Parameters
- $tca : array
- $isFlexForm : bool = false
Return values
arrayaddIgnoredPageTypeRestrictionRecords()
protected
addIgnoredPageTypeRestrictionRecords(array $tca) : array
Parameters
- $tca : array
Return values
arrayaddSystemFieldsToShowitemTypes()
Ensure that all system fields (CType, colPos, hidden etc.) are automatically added to the showitem list of all CTypes in tt_content. As custom CTypes might have added the fields, the respective fields also need to be removed first.
protected
addSystemFieldsToShowitemTypes(array $tca) : array
Parameters
- $tca : array
Return values
arrayconfigureAllowedDisallowedFileExtensions()
configureFileReferences() helper
protected
configureAllowedDisallowedFileExtensions(array $config) : array
Parameters
- $config : array
Return values
arrayconfigureAllowedDisallowedInOverrideChildTca()
configureFileReferences() helper
protected
configureAllowedDisallowedInOverrideChildTca(array $overrideChildTcaConfig) : array
Parameters
- $overrideChildTcaConfig : array
Return values
arrayconfigureAncestorReferenceForMonoglotChildren()
A language-aware table synchronizing an inline or file field to its translations ("l10n_mode" => "exclude" or "allowLanguageSynchronization") gives each translation copies of the children. If the child table is not language-aware, the copies can only be found again through the "origUid" of the child table, which is enforced here.
protected
configureAncestorReferenceForMonoglotChildren(array $tca) : array
Parameters
- $tca : array
Return values
arrayconfigureCategoryRelations()
Prepares TCA configuration of type='category' fields.
protected
configureCategoryRelations(array $tca, bool $isFlexForm) : array
It adds some TCA config settings so category fields end up with similar config as type='select' field, but in a more restricted way. Some settings could also be set in TCA directly, but some fields can not be overridden, e.g. foreign_table.
This also sets necessary MM properties, in case relationship is set to "manyToMany", which is the default. Note it is "oneToMany" with flex forms, since flex forms do NOT support "manyToMany".
Finally, all category fields with a "manyToMany" relationship are added to the MM_oppositeUsage of sys_category "items".
Important: Since this method defines a "foreign_table_where", this must always be executed before prepareQuotingOfTableNamesAndColumnNames().
Parameters
- $tca : array
- $isFlexForm : bool
Return values
arrayconfigureEmailSoftReferences()
Add "'softref' = 'email[subst]'" to all 'type' = 'email' column fields.
protected
configureEmailSoftReferences(array $tca) : array
Parameters
- $tca : array
Return values
arrayconfigureFileReferences()
protected
configureFileReferences(array $tca, bool $isFlexForm) : array
Parameters
- $tca : array
- $isFlexForm : bool
Return values
arrayconfigureLinkSoftReferences()
Add "'softref' = 'typolink'" to all 'type' = 'link' column fields.
protected
configureLinkSoftReferences(array $tca) : array
Parameters
- $tca : array
Return values
arrayconfigureRelationshipToOne()
Add "'maxitems' => 1" to all relation type column fields with 'relationship' set to 'oneToOne' or 'manyToOne'.
protected
configureRelationshipToOne(array $tca) : array
Parameters
- $tca : array
Return values
arrayconfigureSelectSingle()
Add "'relationship' for TCA type "select" fields, having "selectSingle" set as renderType and are pointing to a "foreign_table". Depending on further configuration, this will set the "relationship" to either "manyToMany" (in case "MM" is set) or to "manyToOne".
protected
configureSelectSingle(array $tca) : array
Already defined "relationship" is not overwritten!
This is mainly done to prevent checks on the renderType, which should be avoided.
Parameters
- $tca : array
Return values
arrayprepareFileExtensions()
configureFileReferences() helper: Ensures format, replaces placeholders and remove duplicates
protected
prepareFileExtensions(mixed $fileExtensions) : string
Parameters
- $fileExtensions : mixed