phpBB

Development Wiki

Difference between revisions of "Events"

From phpBB Development Wiki

Line 1: Line 1:
 
==What are events?==
 
==What are events?==
An event is a hook location, also once known as a ledge. When an extension wishes to hook its functionality into the phpBB core at a certain point, it can do so only at available hook locations, or events. For more information, see the wiki article for [[listeners]].
+
Events are triggered in various places of the core phpBB code. Listeners in extensions can be subscribed to these events. They are able to execute code whenever the respective event has occured.  For more information, see the wiki article for [[listeners]].
 +
 
 +
Former names for events are "hook location" and "ledge".
  
 
==Why do we need events?==
 
==Why do we need events?==
Line 11: Line 13:
 
! Name !! Explanation
 
! Name !! Explanation
 
|-
 
|-
| [[Events]] || An event is a hook location, also once known as a ledge. When an extension wishes to hook its functionality into the phpBB core at a certain point, it can do so only at available hook locations, or events. For more information, see the wiki article for [[listeners]].
+
| [[Events]] || Events are triggered in various places of the core phpBB code. Listeners in extensions can be subscribed to these events. They are able to execute code whenever the respective event has occured.  For more information, see the wiki article for [[listeners]].
 
|-
 
|-
| [[Listeners]] || A listener is a way to injecting or modifying code without having to edit the file. Listeners are injected into points that we call [[Events]]. Listeners might also be known as '''hooks'''.
+
| [[Listeners]] || Listeners are triggered by events. They can process incoming data and manipulate variables in the scope of the event. So they can change phpBB's behaviour, add new functionality or if used in the context of templates, modify the output. An alternative name for listeners are "hooks".
 
|-
 
|-
| Subscriber || A subscribed is a collection of [[listeners]]
+
| Subscriber || A subscriber takes care of letting the dispatcher know about [[listeners]] and which events they want to listen to.
 
|-
 
|-
| Dispatcher || N/A
+
| Dispatcher || The event dispatcher takes care of passing control flow to the [[listeners]] when an event occurs that they have been subscribed to by a subscriber.
 
|}
 
|}
  
  
 
[[Category:Events and Listeners]]
 
[[Category:Events and Listeners]]

Revision as of 22:53, 18 March 2012

What are events?

Events are triggered in various places of the core phpBB code. Listeners in extensions can be subscribed to these events. They are able to execute code whenever the respective event has occured. For more information, see the wiki article for listeners.

Former names for events are "hook location" and "ledge".

Why do we need events?

They link the identifiers to the point where the code needs modifying and as such they are vital.

Naming

Name Explanation
Events Events are triggered in various places of the core phpBB code. Listeners in extensions can be subscribed to these events. They are able to execute code whenever the respective event has occured. For more information, see the wiki article for listeners.
Listeners Listeners are triggered by events. They can process incoming data and manipulate variables in the scope of the event. So they can change phpBB's behaviour, add new functionality or if used in the context of templates, modify the output. An alternative name for listeners are "hooks".
Subscriber A subscriber takes care of letting the dispatcher know about listeners and which events they want to listen to.
Dispatcher The event dispatcher takes care of passing control flow to the listeners when an event occurs that they have been subscribed to by a subscriber.