There is
one time when this does not apply; we never need to import 'system' plugins. System
plugins are imported irrespective of the request that is being handled. It is, however,
unlikely that we would ever need to trigger a system event because Joomla! should
handle all system events.
So where and when do we import plugins? Well firstly, it does not matter if we
attempt to import the same group of plugins more than once. At what point we
choose to import the plugins is entirely up to us. The most common place to import
plugins is in a component in a controller.
For example, the search component imports all of the search plugins before it raises
any events that are specific to search plugins:
JPluginHelper::importPlugin('search');
Note that it is not the responsibility of the plugin to load itself. It is up
to the extension that uses the associated plugin group to do this.
Plugin Design
[ 156 ]
In the unlikely event that we want to import a specific plugin, we can do this:
JPluginHelper::importPlugin('foobar', 'somePlugin');
This example imports the plugin somePlugin, located in the foobar group.
Pages:
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222