Download the PHP package markocupic/contao-flash-message without Composer
On this page you can find all versions of the php package markocupic/contao-flash-message. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download markocupic/contao-flash-message
More information about markocupic/contao-flash-message
Files in markocupic/contao-flash-message
Package contao-flash-message
Short Description Adds a flash message service to your Contao application
License GPL-3.0-or-later
Informations about the package contao-flash-message
Contao Flash Bag Message
This Symfony & Contao CMS bundle makes it possible to manage flash messages in an application. With very simple means, a separate message handler can be set up for each controller. Each handler stores the flash messages under a separate subkey in the SESSION. This prevents messages generated by other controllers from being mixed up. All messages are stored in their own subkey/namespace.
Inject the default built-in message handler into your controller
Creating a custom message handler
To create a new message handler, you only need to create a new message class, which:
- implements the
Markocupic\ContaoFlashMessage\FlashMessage\MessageInterfaceinterface - extends the
Markocupic\ContaoFlashMessage\FlashMessage\AbstractMessageclass - and tag it with the
mc.flash_message.message_handlertag. - don't forget to add the unique
messageIdattribute to the tag! - Add the public method
getTypes();. You decide which and how many message types (ERROR.INFO,SUCCESS) you want to add. The Traits can be used to add the message type constants an the helper methods.
The message handler is now registered as a service and can be integrated using dependency injection.
Query messages in Twig directly and in a structured way
Messages can also be queried directly (and selectively/structured) in Twig. The namespace must be specified for this.
All versions of contao-flash-message with dependencies
symfony/http-foundation Version ^6.4 || ^7.0 || ^8.0
symfony/dependency-injection Version ^6.4 || ^7.0 || ^8.0