Back to Joomla project (class list)

Class CMSPlugin - list of methods

Plugin Class

Extends

Direct known subclasses

Package: Joomla\CMS\Plugin
Copyright: (C) 2007 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Plugin/CMSPlugin.php
Project: Joomla

Method Summary

public
(mixed &$subject, mixed $config = array())

Constructor
Parameters
  • \Joomla\Event\DispatcherInterface & $subject The object to observe
  • array $config An optional associative array of configuration settings. Recognized key values include 'name', 'group', 'params', 'language' (this list is not meant to be comprehensive).
Since
  • 1.5
Show source code of this method: __construct Source Code

public bool
(mixed $extension = '', mixed $basePath = JPATH_ADMINISTRATOR)

Loads the plugin language file
Parameters
  • string $extension The extension for which a language file should be loaded
  • string $basePath The basepath to use
Returns
  • bool True, if the file has successfully loaded.
Since
  • 1.5
Show source code of this method: loadLanguage Source Code

public void
()

Registers legacy Listeners to the Dispatcher, emulating how plugins worked under Joomla! 3.x and below.
Returns
  • void
Since
  • 4.0.0
Show source code of this method: registerListeners Source Code

protected void
(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.
Parameters
  • string $methodName The method name to register
Returns
  • void
Since
  • 4.0.0
Show source code of this method: registerLegacyListener Source Code

protected void
(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.
Parameters
  • string $methodName The method name to register
Returns
  • void
Since
  • 4.0.0
Show source code of this method: registerListener Source Code

private bool
(\ReflectionParameter $parameter)

Checks if parameter is typehinted to accept \Joomla\Event\EventInterface.
Parameters
  • \ReflectionParameter $parameter
Returns
  • bool
Since
  • 4.0.0
Show source code of this method: parameterImplementsEventInterface Source Code

Properties Summary

public \Joomla\Registry\Registry
$params
A Registry object holding the parameters for the plugin
Since
  • 1.5
protected string
$_name
The name of the plugin
Since
  • 1.5
protected string
$_type
The plugin type
Since
  • 1.5
protected bool
$autoloadLanguage
Affects constructor behavior. If true, language files will be loaded automatically.
Since
  • 3.1
protected 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.
Since
  • 4.0.0
-
  • bool

Tags Summary

Since
1.5