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 186 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"


Technically the name of the handler can be the name of a class. We rarely need to
use the method in that context because when we load a plugin that defines a class,
Joomla! automatically registers the class and events.
For example, the core Joomla! search component uses plugins to search for results.
The plugin that searches content articles uses the function plgSearchContent() to
handle the onSearch event. This is how the function is registered:
$mainframe->registerEvent('onSearch', 'plgSearchContent');
Handling Events
We mentioned earlier that we could use functions or a class to handle events. We
will start by exploring event handling using functions.
Imagine we have a bespoke plugin called My Plugin in the group Foobar and we
want to handle an event called onPrepareFoobar.
Chapter 6
[ 139 ]
Before we start building our function we need to name it; generally we use the
following naming convention: the word plg, the plugin group, the element name, the
event. For example, we might call the function plgFoobarMyPluginPrepareFoobar.


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