DatabaseRowInitializeNew implements FormDataProviderInterface

On "new" command, initialize new database row with default data

Table of Contents

Interfaces

FormDataProviderInterface
Interface must be implemented by form data provider classes.

Methods

addData()  : array<string|int, mixed>
Initialize new row with default values from various sources There are 4 sources of default values. Mind the order, the last takes precedence.
getRecordTypeFromRow()  : string
Determine the record type from the current database row and additionally fall back to defaultValues as this is basically the only source we have for new records at this point.
mergeTypeSpecificTcaDefaults()  : array<string|int, mixed>
Merge type-specific TCAdefaults over field-level defaults Similar to how TCEFORM type-specific settings work
setDefaultsFromDefaultValues()  : array<string|int, mixed>
Apply default values.
setDefaultsFromInlineParentLanguage()  : array<string|int, mixed>
If a new child is created in an inline relation via ajax, and if the parent is a localized record, the child should have the same sys_language_uid set in the field declared in ['ctrl']['languageField'] if the child is localizable itself.
setDefaultsFromInlineParentUid()  : array<string|int, mixed>
Set the parent uid of inline relations created via ajax to the corresponding foreign field
setDefaultsFromInlineRelations()  : array<string|int, mixed>
Inline scenario if a new intermediate record to an existing child-child is compiled. Set "foreign_selector" field of this intermediate row to given "childChildUid". See TcaDataCompiler array comment of inlineChildChildUid for more details.
setDefaultsFromNeighborRow()  : array<string|int, mixed>
If a neighbor row is given (if vanillaUid was negative), field can be initialized with values from neighbor for fields registered in TCA['ctrl']['useColumnsForDefaultValues'].
setDefaultsFromPageTsConfig()  : array<string|int, mixed>
Set defaults defined by page ts "TCAdefaults" Supports both field-level defaults and type-specific defaults TCAdefaults.tt_content.header_layout = 1 (field-level) TCAdefaults.tt_content.header_layout.types.textmedia = 3 (type-specific)
setDefaultsFromUserTsConfig()  : array<string|int, mixed>
Set defaults defined by user ts "TCAdefaults" Supports both field-level defaults and type-specific defaults TCAdefaults.tt_content.header_layout = 1 (field-level) TCAdefaults.tt_content.header_layout.types.textmedia = 3 (type-specific)
setPid()  : array<string|int, mixed>
Set the pid. This is either the vanillaUid (see description in FormDataCompiler), or a pid given by page TSconfig for inline children.

Methods

addData()

Initialize new row with default values from various sources There are 4 sources of default values. Mind the order, the last takes precedence.

public addData(array<string|int, mixed> $result) : array<string|int, mixed>
Parameters
$result : array<string|int, mixed>

Initialized result array

Tags
throws
UnexpectedValueException
Return values
array<string|int, mixed>

getRecordTypeFromRow()

Determine the record type from the current database row and additionally fall back to defaultValues as this is basically the only source we have for new records at this point.

protected getRecordTypeFromRow(array<string|int, mixed> $result) : string
Parameters
$result : array<string|int, mixed>

The form data result array

Return values
string

The record type value

mergeTypeSpecificTcaDefaults()

Merge type-specific TCAdefaults over field-level defaults Similar to how TCEFORM type-specific settings work

protected mergeTypeSpecificTcaDefaults(array<string|int, mixed> $tcaDefaults, string $recordType) : array<string|int, mixed>
Parameters
$tcaDefaults : array<string|int, mixed>

The TCAdefaults configuration for the table

$recordType : string

The current record type value

Return values
array<string|int, mixed>

Merged defaults with type-specific values taking precedence

setDefaultsFromDefaultValues()

Apply default values.

protected setDefaultsFromDefaultValues(array<string|int, mixed> $result) : array<string|int, mixed>

These are typically carried around as "defVals" GET vars and set by controllers in $result['defaultValues'] array as init values.

Parameters
$result : array<string|int, mixed>

Result array

Return values
array<string|int, mixed>

Modified result array

setDefaultsFromInlineParentLanguage()

If a new child is created in an inline relation via ajax, and if the parent is a localized record, the child should have the same sys_language_uid set in the field declared in ['ctrl']['languageField'] if the child is localizable itself.

protected setDefaultsFromInlineParentLanguage(array<string|int, mixed> $result) : array<string|int, mixed>

A localized parent transfers its sys_language_uid via inlineParentConfig['inline']['parentSysLanguageUid'], use that value as default for the child record languageField.

Parameters
$result : array<string|int, mixed>

Result array

Tags
throws
UnexpectedValueException
Return values
array<string|int, mixed>

Modified result array

setDefaultsFromInlineParentUid()

Set the parent uid of inline relations created via ajax to the corresponding foreign field

protected setDefaultsFromInlineParentUid(array<string|int, mixed> $result) : array<string|int, mixed>
Parameters
$result : array<string|int, mixed>

Result array

Return values
array<string|int, mixed>

setDefaultsFromInlineRelations()

Inline scenario if a new intermediate record to an existing child-child is compiled. Set "foreign_selector" field of this intermediate row to given "childChildUid". See TcaDataCompiler array comment of inlineChildChildUid for more details.

protected setDefaultsFromInlineRelations(array<string|int, mixed> $result) : array<string|int, mixed>
Parameters
$result : array<string|int, mixed>

Result array

Tags
throws
UnexpectedValueException
Return values
array<string|int, mixed>

Modified result array

setDefaultsFromNeighborRow()

If a neighbor row is given (if vanillaUid was negative), field can be initialized with values from neighbor for fields registered in TCA['ctrl']['useColumnsForDefaultValues'].

protected setDefaultsFromNeighborRow(array<string|int, mixed> $result) : array<string|int, mixed>
Parameters
$result : array<string|int, mixed>

Result array

Return values
array<string|int, mixed>

Modified result array

setDefaultsFromPageTsConfig()

Set defaults defined by page ts "TCAdefaults" Supports both field-level defaults and type-specific defaults TCAdefaults.tt_content.header_layout = 1 (field-level) TCAdefaults.tt_content.header_layout.types.textmedia = 3 (type-specific)

protected setDefaultsFromPageTsConfig(array<string|int, mixed> $result) : array<string|int, mixed>
Parameters
$result : array<string|int, mixed>

Result array

Return values
array<string|int, mixed>

Modified result array

setDefaultsFromUserTsConfig()

Set defaults defined by user ts "TCAdefaults" Supports both field-level defaults and type-specific defaults TCAdefaults.tt_content.header_layout = 1 (field-level) TCAdefaults.tt_content.header_layout.types.textmedia = 3 (type-specific)

protected setDefaultsFromUserTsConfig(array<string|int, mixed> $result) : array<string|int, mixed>
Parameters
$result : array<string|int, mixed>

Result array

Return values
array<string|int, mixed>

Modified result array

setPid()

Set the pid. This is either the vanillaUid (see description in FormDataCompiler), or a pid given by page TSconfig for inline children.

protected setPid(array<string|int, mixed> $result) : array<string|int, mixed>
Parameters
$result : array<string|int, mixed>

Result array

Tags
throws
UnexpectedValueException
Return values
array<string|int, mixed>

Modified result array


        
On this page

Search results