BeforeFlexFormDataStructureIdentifierInitializedEvent
New in version 12.0
This event was introduced to replace and improve the method
get
of the hook
$GLOBALS
.
The PSR-14 event
\TYPO3\
can be used to control the FlexForm parsing in an
object-oriented approach.
See also
Example
Have a look at the combined example.
API
- class BeforeFlexFormDataStructureIdentifierInitializedEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Core\ Configuration\ Event\ Before Flex Form Data Structure Identifier Initialized Event
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.- Returns
-
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.
- param $identifier
-
the identifier
Migration
Using the removed hook method get
of
the hook $GLOBALS
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 set
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.