After creating and deleting the object, I redirect to the same action (indexAction). After creating, I would like to make this boot message in the form of flash messages:
<div class="alert alert-success" role="alert"> <a href="#" class="alert-link">...</a> </div>
but after deleting I would like to make another html block:
<div class="alert alert-danger" role="alert"> <a href="#" class="alert-link">...</a> </div>
What is the best way to send this to flash messages? Because, I think that passing all html is not a good idea?
$this->get('session')->getFlashBag()->add( 'notice', '<div class="alert alert-danger" role="alert"> <a href="#" class="alert-link">...</a> </div>' );
Is there any other way to solve this problem?
source share