CMSPlugin
abstract class CMSPlugin implements DispatcherAwareInterface, PluginInterface, LanguageAwareInterface
Plugin Class
Traits
Defines the trait for a language aware class.
Properties
Methods
Constructor
Loads the plugin language file
Registers its listeners.
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.
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.
Returns the internal application or null when not set.
Details
protected Language
getLanguage()
deprecated
deprecated 5.2 will be removed in 7.0 Plugin should use the language from Application, and only after the app is initialised.
Get the Language.
void
setLanguage(Language $language)
deprecated
deprecated 5.2 will be removed in 7.0 Plugin should use the language from Application, and only after the app is initialised
Set the language to use.
bool
loadLanguage(string $extension = '', string $basePath = JPATH_ADMINISTRATOR)
Loads the plugin language file
final protected void
registerLegacyListener(string $methodName)
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.
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
final protected void
registerListener(string $methodName)
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.
protected CMSApplicationInterface|null
getApplication()
Returns the internal application or null when not set.