BeforeFlexFormDataStructureIdentifierInitializedEvent

New in version 12.0: This event was introduced to replace and improve the method getDataStructureIdentifierPreProcess() ot the hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'].

This event can be used to control the flex form parsing in an object oriented approach.

API

class TYPO3\CMS\Core\Configuration\Event\BeforeFlexFormDataStructureIdentifierInitializedEvent

Listeners to this event are able to specify the data structure identifier, used for a given TCA flex field.

Listeners should call ->setIdentifier() to set the identifier or ignore the event to allow other listeners to set it. Do not set an empty string as this will immediately stop event propagation!

The identifier SHOULD include the keys specified in the Identifier definition on FlexFormTools, and nothing else. Adding other keys may or may not work, depending on other code that is enabled, and they are not guaranteed nor covered by BC guarantees.

Warning: If adding source record details like the uid or pid here, this may turn out to be fragile. Be sure to test scenarios like workspaces and data handler copy/move well, additionally, this may break in between different core versions. It is probably a good idea to return at least something like [ 'type' => 'myExtension', ... ], see the core internal 'tca' and 'record' return values below

See the note on FlexFormTools regarding the schema of $dataStructure.

getFieldTca()

Returns the full TCA of the currently handled field, having type=flex set.

Return type

array

getTableName()
Return type

string

getFieldName()
Return type

string

getRow()

Returns the whole database row of the current record.

Return type

array

setIdentifier(array $identifier)

Allows to define the data structure identifier for the TCA field.

Setting an identifier will immediately stop propagation. Avoid setting this parameter to an empty array as this will also stop propagation.

Parameters
  • $identifier (array) -- the identifier

getIdentifier()

Returns the current data structure identifier, which will always be null for listeners, since the event propagation is stopped as soon as a listener defines an identifier.

Return type

array

isPropagationStopped()
Return type

bool

Migration

Using the removed hook method getDataStructureIdentifierPreProcess() of the hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'] previously required implementations to always return an array.

This means, implementations returned an empty array in case they did not want to set an identifier, allowing further implementations to be called.

This behaviour has now changed. As soon as a listener sets the identifier using the setIdentifier() method, the event propagation is stopped immediately and no further listeners are being called. Therefore, listeners should avoid setting an empty array but should just "return" without any change to the $event object in such a case.