Skip to content

Instantly share code, notes, and snippets.

@gelbehexe
Last active July 2, 2020 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gelbehexe/eff430926d7b9f52829c to your computer and use it in GitHub Desktop.
Save gelbehexe/eff430926d7b9f52829c to your computer and use it in GitHub Desktop.
How to generate a flash message in TYPO3 6.x+
<?php
....
// creating the message
/** @var \TYPO3\CMS\Core\Messaging\FlashMessage $message */
$message = GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
'Falscher Fehler',
'',
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING
);
// getting flashMessageService instance (Singleton)
/** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
$flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
// adding message to default queue
$flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment