I'm migrating an extension from V10 LTS to V11 LTS. Some of its records need post-processing after being edited in the BE. This is done via the core hook processDatamap_afterDatabaseOperations()
. The hook is processed fine, everything ok there.
But depending on the result of the post-processing the hook code will issue a flash message (either success or a warning). This has worked fine in V10, but no flash messages are shown in V11.
The flash messages are added to the flash message queue, exactly as shown in the core documentation:
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$messageQueue = $flashMessageService->getMessageQueueByIdentifier();
$messageQueue->addMessage($message);
The core documentation for this has not changed from V10 to V11, but the actual behaviour is obviously not the same anymore (at least in this context).
Another thing I have noticed: while debugging, I tried to send some debug output with debug()
. In V10 this works as expected, but in V11 nothing is shown (and yes, devIPmask
is set correctly and debug()
generally works fine in BE). It seems as if all output generated within hooks is somehow swallowed.
Am I missing someting? Can you still issue flash messages from a core hook in V11 and if yes, how?
When executing DataHandler in CLI request, the DataHandler will fail as there is no user session available. For this reason, all code in TYPO3 Core towards proper logging.
When running in Web context, the errors will then be converted to FlashMessages via printErrorLogMessages(), automatically.
One example on how this is migrated can be seen here: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79002