I've been writing an editor plugin. In its get_field(&$qa_content, $content, $format, $fieldname, $rows, $autofocus) function I need to know whether the current request is a question editing page.
How do I do this? It'd be nice if the code doesn't break on future Q2A updates.
Note that qa_request() just gives the question number and title, no specification as to whether the page is in edit mode.
This should be enough to check whether you're editing: strpos(qa_get_state(), 'edit') === 0
As the template is accessible from the theme or from a layer plugin, you can't use it. The closest thing to check whether you are in a question template or not would be to check this: isset($qa_content['q_view'])
So the final code would look like this:
I always use:
if($this->template=='question' && strpos(qa_get_state(),'edit')!==false) { for my plugins.
Welcome to the Q&A site for Question2Answer.
If you have a question about Q2A, please ask here, in English.
To report a bug, please create a new issue on Github or ask a question here with the bug tag.
If you just want to try Q2A, please use the demo site.