Add Alerts
Shopware gives you the possibility to print out alert messages at the top of a page, coming from a Controller or a Subscriber. This is done via so-called flashes.
To do this we call one of two methods. The parameters for both methods are identical however:
type- The alert message type. This is one of: 'info' (blue), 'warning' (orange) or 'error' (red)message- The text you want to be printed in the message. (Hint: You can use snippets by calling $this-trans('snippet.name'))
The methods are:
In a Controller
$this->addFlash(<type>, <message>)
In a Subscriber
$this->session->getFlashBag()->add(<type>, <message>)
tip
The message will be shown only once on the next possible page that includes the alert.html.twig Template.