BeforeFlexFormDataStructureParsedEvent
New in version 12.0
This event was introduced to replace and improve the method
parse
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 BeforeFlexFormDataStructureParsedEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Core\ Configuration\ Event\ Before Flex Form Data Structure Parsed Event
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 asstring
. 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
Migration
Using the removed hook method parse
of hook $GLOBALS
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 set
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.