Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
594 views
in Plugins by
edited by

Not very important, but graphic rules are useful to let admins work fast.

It is in the context of function admin_form(&$qa_content) { } in the admin script of a plugin

It returns an array with a 'ok' field . In most cases ,  if the input is rejected , it is empty.

Is there a conventionnal return to get a red header ( instead of green ) ?

or did you see a plugin using this red header after user input errors ?

thank you

 

 

Q2A version: 1.7

1 Answer

+1 vote
by
selected by
 
Best answer

Not in the same way as the successful one. You can add the error to the plugin page as a whole, which leaves it right on the top this way:

$this->content['error'] = 'Bad input!';

Or you can add the 'error' key to the field array that generates the issue, if any.

But you made a good point. Probably, that's something to work on today :)

by
nice idea ! I used the note zone , green for notes and red for errors , returning ok empty as done in the faq plugin ( the starting model ). TY :)
by
Remember to test the plugin both in wide and tall forms and in different themes
by
for this one, decoration is conservative with a very limited inline css and only spans and div. But before publishing, it needs a solution for php prior to 5.2.3 ( QA is done to work from 5.1 ) and to be checked on php 7.0 beta , which will enter in production in some weeks.
...