heimrichhannot / contao-status_messages
A general status message bundle for the frontend.
Installs: 9 113
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
Type:contao-bundle
Requires
- php: ^7.2|^8.0
- contao/core-bundle: ^4.9
- heimrichhannot/contao-encore-contracts: ^1.0
- symfony/config: ^4.4||^5.4
- symfony/dependency-injection: ^4.4||^5.4
- symfony/http-kernel: ^4.4||^5.4
- symfony/service-contracts: ^1.0 || ^2.0 || ^3.0
README
A general status message module for the frontend.
Features
- use same functionality as contao message class in the frontend
- Encore Bundle support
Usage
Install
-
Install with composer or contao manager
composer require heimrichhannot/contao-status_messages
-
Update database
In a module
Simply add the following to your template:
<?php echo \HeimrichHannot\StatusMessages\StatusMessage::generate($this->id); ?>
To add new Messages use the appropriate function in StatusMessage:
StatusMessage::addError('An error has happened', $this->id);
By using the global frontend module ModuleStatusMessages
Simply add the module to your page. The contained javascript gets all messages thrown in your modules and adds it to the global markup element. It's necessary to use javascript here since else you get problems with order and redirects.