pluginsactiondokuwiki

How to abort an ACTION in a Dokuwiki plugin?


I'm writing a Dokuwiki plugin to disallow a page from being edited under certain conditions. I've written a handler for ACTION_ACT_PREPROCESS-before to test for the condition. If the handler decides to disallow the edit, it calls msg($errmsg, -1). Then I want for the page the user was browsing to remain displayed.

I've added calls to

$event->preventDefault();
$event->stopPropagation();
return true;

as exemplified in the Discussion plugin, but DW displays an editor window instead.

What should I do to basically abort the command and remain on the current page?


Solution

  • The passed data is writable. You want to switch back to the show action. Eg.

    $event->data = 'show';`