BeforeFlexFormDataStructureParsedEvent

New in version 12.0

The PSR-14 event \TYPO3\CMS\Core\Configuration\Event\BeforeFlexFormDataStructureParsedEvent can be used to control the FlexForm parsing in an object-oriented approach.

Example

Have a look at the combined example.

API

class BeforeFlexFormDataStructureParsedEvent
Fully qualified name
\TYPO3\CMS\Core\Configuration\Event\BeforeFlexFormDataStructureParsedEvent

Listeners to this event are able to specify a flex form data structure that corresponds to a given identifier.

Listeners should call ->setDataStructure() to set the data structure (this can either be a resolved data structure string, a "FILE:" reference or a fully parsed data structure as array) or ignore the event to allow other listeners to set it. Do not set an empty array or string as this will immediately stop event propagation!

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

getDataStructure ( )

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

Returns
array|string|?null
setDataStructure ( array|string $dataStructure)

Allows to either set an already parsed data structure as array, a file reference or the XML structure as string. Setting a data structure will immediately stop propagation. Avoid setting this parameter to an empty array or string as this will also stop propagation.

param $dataStructure

the dataStructure

getIdentifier ( )
Returns
array
isPropagationStopped ( )
Returns
bool

Migration

Using the removed hook method parseDataStructureByIdentifierPreProcess() of hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray'] previously required implementations to always return an array or string. Implementations returned an empty array or empty string in case they did not want to set a data structure.

This behaviour has now changed. As soon as a listener sets a data structure using the setDataStructure() method, the event propagation is stopped immediately and no further listeners are called.

Therefore, listeners should avoid setting an empty array or an empty string but should just "return" without any change to the $event object in such a case.