Reputation: 589
I want to use an <a>
inside a flashMessenger message.
For example:
In my website I have some blog posts, and when I delete one of them, I want to show a message like:
"Success! <a>Undo</a>
"
My code:
$restore = $this->url()->fromRoute('news/restore', array('id' => $id));
$this->flashMessenger()->addSuccessMessage("Success. <a href='$restore'>Undo</a>");
return $this->redirect()->toRoute('news');
But It doesn't work when I put that <a>
inside the message.
How can I do that?
Upvotes: 3
Views: 1122
Reputation: 91
The way it worked for me:
<?php if($this->flashMessenger()->hasMessages()): ?>
<div class="alert alert-info flash-messenger">
<?=$this->flashMessenger()->setAutoEscape(false)->render(); ?>
</div>
<?php endif; ?>
By default the autoEscape property is set to true
Factory? Maybe?
source:
https://github.com/zendframework/zend-view/blob/master/src/Helper/FlashMessenger.php
Upvotes: 5