winston Posted December 16, 2014 Share Posted December 16, 2014 I used to be able to include a link in module messages, like this: $this->message("Page <a href='$url'>$title</a> generated"); In recent versions, the message gets the htmlspecialchars treatment before output, and the link doesn't work. I tried looking but couldn't find where the messages get output formatted. Thanks for your help! Link to comment Share on other sites More sharing options...
adrian Posted December 16, 2014 Share Posted December 16, 2014 I don't think I ever tried to output html in messages in the existing message/error system, but with the new notifications system, it is easy: $this->user->notifications->message("Message Title")->html("Message details including a <a href=''>link</a>"); You will need to enable the new core notifications module. 2 Link to comment Share on other sites More sharing options...
winston Posted December 16, 2014 Author Share Posted December 16, 2014 Thanks, Adrian. The new notifications system will be interesting, but in the meantime I took a break, then found what I was looking for in Notices.php. The answer is: $this->message("This message contains <a href=''>a link</a>", Notice::allowMarkup); The code from Notices.php couldn't be clearer: /** * Flag indicates the notice is allowed to contain markup and won't be automatically entity encoded * * Note: entity encoding is done by the admin theme at output time. * */ const allowMarkup = 32; /** * Create the Notice * * @param string $text * @param int $flags * */ public function __construct($text, $flags = 0) { $this->set('text', $text); $this->set('class', ''); $this->set('timestamp', time()); $this->set('flags', $flags); } 7 Link to comment Share on other sites More sharing options...
kongondo Posted December 16, 2014 Share Posted December 16, 2014 Was just about to post that . Learn't about it when PW switched from TinyMCE to CKEditor in core (the big red error notice with links)... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now