This extension simplifies use of flash messages in templates just to {control flashMessage}
:
Also includes translator support and css class prefix.
Via Composer:
$ composer require zenify/flash-message-component
And register extension in config.neon
:
extensions:
- Zenify\FlashMessageComponent\DI\FlashMessageExtension
Inject to presenter
class Presenter ...
{
/**
* @inject
* @var Zenify\FlashMessageComponent\FlashMessageControlFactory
*/
public $flashMessageControlFactory;
/**
* @return Zenify\FlashMessageComponent\FlashMessageControl
*/
public function createComponentFlashMessage()
{
return $this->flashMessageControlFactory->create();
}
}
Render in template
{control flashMessage}