phpBB

Development Wiki

Difference between revisions of "Add Listeners"

From phpBB Development Wiki

(Created page with "NOTE: This article is a WIP by Unknown Bliss ==What are listeners?== Listeners are a way of injecting code and manipulating variables in the code where events exist without e...")
 
(moved to new docs)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
NOTE: This article is a WIP by Unknown Bliss
+
This documentation has been moved to the new phpBB Development Documentation.
  
==What are listeners?==
+
[https://area51.phpbb.com/docs/dev/31x/extensions/tutorial_events.html#php-core-events-listeners Extensions: PHP Core Events & Listeners].
Listeners are a way of injecting code and manipulating variables in the code where events exist without editing the code. Numerous listeners form part of a subscriber. The listener is a method within your subscriber class in your extension, which is then identified as to which event it corresponds to by an identifying method. This sounds daunting but it a lot simpler in practice.  They are part of the [[listeners]] system added in 3.1
+
 
+
==What are subscribers?==
+
A subscriber is a class which includes a set of listeners as methods, each of which can listen for an even to be triggered. They are 'linked' with the event by an identification method. You can have as many listeners inside a subscriber as you wish. You should only need 1 subscriber per extension however if you have a large number you may choose to split it up into several files.
+
 
+
==Creating a subscriber==
+
Explain the file name, directory to put it in, identifier method, which class to extend etc.
+
 
+
==Creating a listener==
+
Explain how it injects and how to manipulate variables.
+
 
+
==Putting it together==
+
Example of a subscriber file including 2 listeners
+
 
+
[[Category:Events and Listeners]]
+

Latest revision as of 18:44, 5 December 2016

This documentation has been moved to the new phpBB Development Documentation.

Extensions: PHP Core Events & Listeners.