-
Book Overview & Buying
-
Table Of Contents
Mastering Joomla! 1.5 Extension and Framework Development Second Edition
By :
As we have already mentioned, plugins use the observer pattern to keep an eye on events and handle them. The observer pattern is a design pattern that is common in programming. This particular pattern allows listeners to attach to a subject. The subject can initiate a notification (essentially an event), which will cause the listeners to react to the event.
The expressions 'listener' and 'observer' are interchangeable, as are 'subject' and 'observable'.
If you are unfamiliar with the observer pattern, you may want to refer to http://www.phppatterns.com/docs/design/observer_pattern.
When we create plugins, we generally define listeners for specific events.
The application uses a global object called the event dispatcher to dispatch events to registered listeners. The global event dispatcher, a JEventDispatcher object, extends the abstract JObservable class.
In Joomla!, a listener can be a class or a function. When we use a class listener, the class should extend the abstract class JPlugin...
Change the font size
Change margin width
Change background colour