Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin changes #70

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions migrations/44-50/new-deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,22 @@ All the new deprecations that should be aware of and what you should now be usin
This page is unfinished, please use the **Edit this Page** link at the bottom of this page to help make it more useful.

:::

### Joomla\CMS\Extension\PluginInterface to no longer extend Joomla\Event\DispatcherAwareInterface
In 6.0 `Joomla\CMS\Extension\PluginInterface` will no longer extend `Joomla\Event\DispatcherAwareInterface`. An instance of `Joomla\Event\DispatcherInterface` must be passed to `Joomla\CMS\Extension\PluginInterface::registerListeners()` instead. This applies to the `Joomla\CMS\Plugin\CMSPlugin` implementation too.

### Joomla\CMS\Plugin\CMSPlugin::__construct() to longer accept an instance of Joomla\Event\DispatcherInterface
In 6.0 passing an instance of `Joomla\Event\DispatcherInterface` as the first argument to `Joomla\CMS\Plugin\CMSPlugin::__construct()` will not be supported. An instance of `Joomla\Event\DispatcherInterface` must be passed to `Joomla\CMS\Plugin\CMSPlugin::registerListeners()` instead.

### Joomla\CMS\Plugin\CMSPlugin::registerLegacyListener() and Joomla\CMS\Plugin\CMSPlugin::registerListeners() deprecated
`Joomla\CMS\Plugin\CMSPlugin::registerLegacyListener()` and `Joomla\CMS\Plugin\CMSPlugin::registerListener()` methods are deprecated and will be removed in 6.0. Listeners must be registered with the event dispatcher in the `registerListeners()` method.

### Joomla\CMS\Plugin\PluginHelper::importPlugin() signature change
In 6.0 the fourth argument of `Joomla\CMS\Plugin\PluginHelper::importPlugin()` will no longer be optional and will require an instance of `Joomla\Event\DispatcherInterface`. Therefore, preceding arguments will become mandatory. Method calls must be updated accordingly, for example:

```php
Joomla\CMS\Plugin\PluginHelper::importPlugin('system', null, true, $dispatcher);
```

### Joomla\CMS\Plugin\PluginHelper::import() signature change
In 6.0 the third argument of `Joomla\CMS\Plugin\PluginHelper::import()` will not longer be optional and will require an instance of `Joomla\Event\DispatcherInterface`. Therefore, preceding arguments will become mandatory.
14 changes: 14 additions & 0 deletions migrations/44-50/removed-backward-incompatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ class MyModel extends ListModel {

### CSS removals
The CSS class ".ie11" was removed [via PR #39018](https://github.com/joomla/joomla-cms/pull/39018)

### Joomla\CMS\Extension\PluginInterface::registerListeners() signature change
`Joomla\CMS\Extension\PluginInterface::registerListeners()` method signature has been changed to accept an instance of `Joomla\Event\DispatcherInterface`. The argument is made optional to allow plugin developers to easily support both 4.0 and 5.0. It will become mandatory in 6.0.

The signature in implementations must be changed accordingly:
```php
class MyPlugin implements \Joomla\CMS\Extension\PluginInterface
{
public function registerListeners(?\Joomla\Event\DispatcherInterface $dispatcher = null)
{
// Register listeners with the event dispatcher.
}
}
```