DummyPlugin
Extends CMSPluginPlaceholder plugin.
since |
4.0.0 |
---|---|
package |
Joomla CMS |
Methods
__construct
Constructor
__construct(\Joomla\Event\DispatcherInterface &subject, array config = array()) : mixed
since |
1.5 |
---|
Arguments
- subject
\Joomla\Event\DispatcherInterface
The object to observe- config
array
An optional associative array of configuration settings. Recognized key values include 'name', 'group', 'params', 'language' (this list is not meant to be comprehensive).
Response
mixed
getApplication
Returns the internal application or null when not set.
getApplication() : \Joomla\CMS\Application\CMSApplicationInterface|null
since |
4.2.0 |
---|
Response
\Joomla\CMS\Application\CMSApplicationInterface|null
loadLanguage
Loads the plugin language file
loadLanguage(string extension = '', string basePath = JPATH_ADMINISTRATOR) : bool
since |
1.5 |
---|
Arguments
- extension
string
The extension for which a language file should be loaded- basePath
string
The basepath to use
Response
bool
True, if the file has successfully loaded.
parameterImplementsEventInterface
Checks if parameter is typehinted to accept \Joomla\Event\EventInterface.
parameterImplementsEventInterface(\ReflectionParameter parameter) : bool
since |
4.0.0 |
---|
Arguments
- parameter
\ReflectionParameter
Response
bool
registerLegacyListener
Registers a legacy event listener, i.e. a method which accepts individual arguments instead of an AbstractEvent in its arguments. This provides backwards compatibility to Joomla! 3.x-style plugins.
registerLegacyListener(string methodName) : void
This method will register lambda functions (closures) which try to unwrap the arguments of the dispatched Event into old style method arguments and call your on<Something> method with them. The result will be passed back to the Event, as an element into an array argument called 'result'.
since |
4.0.0 |
---|
Arguments
- methodName
string
The method name to register
registerListener
Registers a proper event listener, i.e. a method which accepts an AbstractEvent as its sole argument. This is the preferred way to implement plugins in Joomla! 4.x and will be the only possible method with Joomla! 5.x onwards.
registerListener(string methodName) : void
since |
4.0.0 |
---|
Arguments
- methodName
string
The method name to register
registerListeners
Registers legacy Listeners to the Dispatcher, emulating how plugins worked under Joomla! 3.x and below.
registerListeners() : void
By default, this method will look for all public methods whose name starts with "on". It will register lambda functions (closures) which try to unwrap the arguments of the dispatched Event into method call arguments and call your on<Something> method. The result will be passed back to the Event into its 'result' argument.
This method additionally supports Joomla\Event\SubscriberInterface and plugins implementing this will be registered to the dispatcher as a subscriber.
since |
4.0.0 |
---|
setApplication
Sets the application to use.
setApplication(\Joomla\CMS\Application\CMSApplicationInterface application) : void
since |
4.2.0 |
---|
Arguments
- application
\Joomla\CMS\Application\CMSApplicationInterface
The application
Properties
params
A Registry object holding the parameters for the plugin
since |
1.5 |
---|
Type(s)
\Joomla\Registry\Registry
autoloadLanguage
Affects constructor behavior. If true, language files will be loaded automatically.
allowLegacyListeners
Should I try to detect and register legacy event listeners, i.e. methods which accept unwrapped arguments? While this maintains a great degree of backwards compatibility to Joomla! 3.x-style plugins it is much slower. You are advised to implement your plugins using proper Listeners, methods accepting an AbstractEvent as their sole parameter, for best performance. Also bear in mind that Joomla! 5.x onwards will only allow proper listeners, removing support for legacy Listeners.