[dokuwiki] Re: Action Plugins

  • From: "Martin Tschofen" <martin.tschofen@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 22 Apr 2006 08:51:42 -0500

On 4/22/06, Chris Smith <chris@xxxxxxxxxxxxx> wrote:
>
> function register(...) {
>   $controller->register_hook('ACTION_DISPATCH', $this, 'collect', NULL);
> }
> function collect(...) {
>   if ($event->data != "collect") return;
>
>   $event->preventDefault();
>   $controller->register_hook('TPL_ACTION_HTML', $this, 'find_pages', NULL);
> }

So $event->preventDefault(); is really a requirement with custom commands.

You're example above doesn't work with the second register_hook in
place. I had to change it to using the event_handler...

  function register(&$controller) {
    $controller->register_hook('ACTION_DISPATCH', $this, 'collect', NULL);
  }

  function collect($param, &$event){
    if ($event->data != 'collect') return;
        $event->preventDefault();
        global $EVENT_HANDLER;
    $EVENT_HANDLER->register_hook('TPL_ACTION_HTML', $this, 'find_pages', NULL);
        $event->stopPropagation();
  }

Thanks again...martin
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: