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 2 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
16 changes: 16 additions & 0 deletions migrations/44-50/new-deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,19 @@ 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 `Joomla\CMS\Plugin\CMSPlugin` implementation too.
SharkyKZ marked this conversation as resolved.
Show resolved Hide resolved

### 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 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.
SharkyKZ marked this conversation as resolved.
Show resolved Hide resolved

### 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 fourth argument of `Joomla\CMS\Plugin\PluginHelper::importPlugin()` will no longer be optional and will require an instance of `Joomla\Event\DispatcherInterface`. Therefore, preceeding arguments will become mandatory. Method calls must be updated accordingly, for example:
SharkyKZ marked this conversation as resolved.
Show resolved Hide resolved

```php
Joomla\CMS\Plugin\PluginHelper::importPlugin('system', null, true, $dispatcher);
```
16 changes: 16 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,19 @@ 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 easily support both 4.0 and 5.0. It will become mandatory in 6.0.
SharkyKZ marked this conversation as resolved.
Show resolved Hide resolved

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.
}
}
```
### Joomla\CMS\Plugin\PluginHelper::import() arguments no longer optional
`Joomla\CMS\Plugin\PluginHelper::import()` arguments are now mandatory. Third argument is no longer nullable and requires an instance of `Joomla\Event\DispatcherInterface`.
SharkyKZ marked this conversation as resolved.
Show resolved Hide resolved