SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 185 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

The second parameter must always be an array. This array is dissected,
and each element is used as a separate parameter when dispatching an event to
a listener.
We purposefully make sure that $foobarData is passed by reference so we can make
changes to $foobarData in our listeners.
Once all of the listeners have been updated, the method returns an array of
responses. In our example this is recorded in $result. Imagine that all of the
onPrepareFoobar listeners return a Boolean value. $result would contain an array
of Boolean values.
Listeners
There is one more thing we need to do first. We need to know how to attach listeners
to the event dispatcher.
Registering Listeners
When we create a new plugin, if we are using functions, we must inform the
application of each function and event. We do this using the application's
registerEvent() method. The method accepts two parameters, the name of the
event and the name of the handler. This acts as a pass-through method for the global
event dispatcher register() method.


Pages:
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197