It looks like you're new here. If you want to get involved, click one of these buttons!
I have written a SSO plugin and I want to display an error message with the vanilla style with the current theme. How can I do it?
what type of error?
validation, notfound, denied, etc
Don't PM about development, I'm not currently taking on clients.
grep is your friend.
It is a LTI plugin so they will be messages when a external application passes on the request information to my plugin. This plugin handles authentication a validation of the information received
One of the messages p.e, is 'LTI context not available but needed. Proceess aborted'
In fact, I think it doesn't matter the type of message. In general I would like to display a personalized message. Now I'm using echo and exit and redirect.
When I interpret the text from your reply to x00, I would say the errortype would be 'validation'. Let's see if Garden has a special errortype for that. Please add a Wiki page when you've found what you're looking for, explaining how to use, etc. :-)
What to do if I get a Bonk Error?
Well it matter in terms of style, status codes etc. Whether true error, just relaying information.
if you just want a bonk/debug message then use
throw new ErrorException('Error Message.');
A useful method that I have used for permission errors is
$Message = T('You do not have permission to bla, bla, bla');
throw new Exception($Message,401);
However there isn't a general error message page other than Bonk, and debug mode (which isn't ideal to show) If you include a view like so, it will display roughly equivalent.
<h1><?php echo T('Error Message Title'); ?></h1>
<p><?php echo T('Error Message'); ?></p>
If you want those inline red validation messages, a bit like flash
<div class="Messages Errors">
<li><?php echo T('Error Message'); ?></li>
You can also use inform messages for more low key notification.
Eventually, I have used the PermissionErrorMessage.
For one case, which displayed more information, I have used a simple echo because I wanted to add more views to the plugin.
Thank you for your help.