DatabaseRowInitializeNew

class \TYPO3\CMS\Backend\Form\FormDataProvider\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
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
Merge type-specific TCAdefaults over field-level defaults Similar to how TCEFORM type-specific settings work
setDefaultsFromDefaultValues()  : array
Apply default values.
setDefaultsFromInlineParentLanguage()  : array
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
Set the parent uid of inline relations created via ajax to the corresponding foreign field
setDefaultsFromInlineRelations()  : array
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
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
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
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
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 $result) : array

Parameters

$result : array

Initialized result array

Tags

throws
UnexpectedValueException

Return values

array

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 $result) : string

Parameters

$result : array

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 $tcaDefaults, string $recordType) : array

Parameters

$tcaDefaults : array

The TCAdefaults configuration for the table

$recordType : string

The current record type value

Return values

array —

Merged defaults with type-specific values taking precedence

setDefaultsFromDefaultValues()

Apply default values.

protected setDefaultsFromDefaultValues(array $result) : array

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

Parameters

$result : array

Result array

Return values

array —

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 $result) : array

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

Result array

Tags

throws
UnexpectedValueException

Return values

array —

Modified result array

setDefaultsFromInlineParentUid()

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

protected setDefaultsFromInlineParentUid(array $result) : array

Parameters

$result : array

Result array

Return values

array

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 $result) : array

Parameters

$result : array

Result array

Tags

throws
UnexpectedValueException

Return values

array —

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 $result) : array

Parameters

$result : array

Result array

Return values

array —

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 $result) : array

Parameters

$result : array

Result array

Return values

array —

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 $result) : array

Parameters

$result : array

Result array

Return values

array —

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 $result) : array

Parameters

$result : array

Result array

Tags

throws
UnexpectedValueException

Return values

array —

Modified result array

On this page