[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Extension/ -> Event.php (summary)

(no description)

File Size: 202 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Event:: (10 methods):
  __construct()
  __toString()
  advise_before()
  advise_after()
  trigger()
  stopPropagation()
  mayPropagate()
  preventDefault()
  mayRunDefault()
  createAndTrigger()


Class: Event  - X-Ref

The Action plugin event

__construct($name, &$data)   X-Ref
event constructor

param: string $name
param: mixed $data

__toString()   X-Ref

return: string

advise_before($enablePreventDefault = true)   X-Ref
advise all registered BEFORE handlers of this event

if these methods are used by functions outside of this object, they must
properly handle correct processing of any default action and issue an
advise_after() signal. e.g.
$evt = new dokuwiki\Plugin\Doku_Event(name, data);
if ($evt->advise_before(canPreventDefault) {
// default action code block
}
$evt->advise_after();
unset($evt);

param: bool $enablePreventDefault
return: bool results of processing the event, usually $this->runDefault

advise_after()   X-Ref
advise all registered AFTER handlers of this event

param: bool $enablePreventDefault
see: advise_before() for details

trigger($action = null, $enablePrevent = true)   X-Ref
trigger

- advise all registered (<event>_BEFORE) handlers that this event is about to take place
- carry out the default action using $this->data based on $enablePrevent and
$this->_default, all of which may have been modified by the event handlers.
- advise all registered (<event>_AFTER) handlers that the event has taken place

param: null|callable $action
param: bool $enablePrevent
return: mixed $event->results

stopPropagation()   X-Ref
stopPropagation

stop any further processing of the event by event handlers
this function does not prevent the default action taking place

mayPropagate()   X-Ref
may the event propagate to the next handler?

return: bool

preventDefault()   X-Ref
preventDefault

prevent the default action taking place

mayRunDefault()   X-Ref
should the default action be executed?

return: bool

createAndTrigger($name, &$data, $action = null, $canPreventDefault = true)   X-Ref
Convenience method to trigger an event

Creates, triggers and destroys an event in one go

param: string $name name for the event
param: mixed $data event data
param: callable $action (optional, default=NULL) default action, a php callback function
param: bool $canPreventDefault (optional, default=true) can hooks prevent the default action
return: mixed                        the event results value after all event processing is complete