DummyPlugin

Extends CMSPlugin

Placeholder plugin.

since

4.0.0

package

Joomla CMS

Methods

__construct

Constructor

__construct(mixed||string|int config = []) : 
inherited
since

1.5

Arguments

config

array<string|int, mixed>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
inherited
since

4.2.0

Response

CMSApplicationInterface|null

getDispatcher

Get the event dispatcher.

getDispatcher() : \Joomla\Event\DispatcherInterface
inherited deprecated
throws

UnexpectedValueExceptionMay be thrown if the dispatcher has not been set.

since

5.3.0

deprecated

5.2 will be removed in 7.0 Plugin should implement DispatcherAwareInterface on its own, when it is needed.

Response

DispatcherInterface

getLanguage

Get the Language.

getLanguage() : \Joomla\CMS\Language\Language
inherited deprecated
throws

UnexpectedValueExceptionMay be thrown if the language has not been set.

since

5.3.0

deprecated

5.2 will be removed in 7.0 Plugin should use the language from Application, and only after the app is initialised.

Response

Language

loadLanguage

Loads the plugin language file

loadLanguage( extension = '',  basePath = JPATH_ADMINISTRATOR) : 
inherited
since

1.5

Arguments

extension

stringThe extension for which a language file should be loaded

basePath

stringThe basepath to use

Response

boolTrue, if the file has successfully loaded.

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( methodName) : 
inherited final deprecated

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

deprecated

5.4.0 will be removed in 7.0 Plugin should implement SubscriberInterface.

Arguments

methodName

stringThe method name to register

Response

void

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( methodName) : 
inherited final deprecated
since

4.0.0

deprecated

5.4.0 will be removed in 7.0 Plugin should implement SubscriberInterface.

Arguments

methodName

stringThe method name to register

Response

void

registerListeners

Registers legacy Listeners to the Dispatcher, emulating how plugins worked under Joomla! 3.x and below.

registerListeners() : 
inherited deprecated

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

deprecated

5.4.0 will be removed in 7.0 Plugin should implement SubscriberInterface. These plugins will be added to dispatcher in PluginHelper::import().

Response

void

setApplication

Sets the application to use.

setApplication(\Joomla\CMS\Application\CMSApplicationInterface application) : 
inherited
since

4.2.0

Arguments

application

CMSApplicationInterfaceThe application

Response

void

setDispatcher

Set the dispatcher to use.

setDispatcher(\Joomla\Event\DispatcherInterface dispatcher) : 
inherited deprecated
since

5.3.0

deprecated

5.2 will be removed in 7.0 Plugin should implement DispatcherAwareInterface on its own, when it is needed.

Arguments

dispatcher

DispatcherInterfaceThe dispatcher to use.

Response

$this

setLanguage

Set the language to use.

setLanguage(\Joomla\CMS\Language\Language language) : 
inherited deprecated
since

5.3.0

deprecated

5.2 will be removed in 7.0 Plugin should use the language from Application, and only after the app is initialised

Arguments

language

LanguageThe language to use

Response

void

Properties

language

Language

inherited
since

4.4.0

Type(s)

Language

params

A Registry object holding the parameters for the plugin

inherited
since

1.5

Type(s)

Registry

_name

The name of the plugin

inherited
since

1.5

Type(s)

string

_type

The plugin type

inherited
since

1.5

Type(s)

string

autoloadLanguage

If true, language files of the plugin will be loaded automatically.

inherited

NOTE: Enabling this feature have a negative effect on performance, therefore it is recommended to load a language manually, in the respective event.

since

3.1

Type(s)

bool

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.

inherited deprecated
since

4.0.0

deprecated

4.3 will be removed in 6.0 Implement your plugin methods accepting an AbstractEvent object Example: onEventTriggerName(AbstractEvent $event) { $context = $event->getArgument(...); }

Type(s)

bool