Skip to content

Commit 25ce28a

Browse files
authored
Merge pull request #419 from Fedik/pr-43430
CMSPlugin: Deprecate use of DispatcherAware and LanguageAware
2 parents 8e0574a + 9746282 commit 25ce28a

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

migrations/52-53/new-deprecations.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ $model = $this->getModel();
2323
$this->items = $model->getItems();
2424
```
2525
#### Explanation
26-
Joomla and most extensions have extensively been using `Joomla\CMS\MVC\View\AbstractView::get()` in all views. From 5.3 onwards, this method is deprecated and is going to be removed in Joomla 7.0.
26+
Joomla and most extensions have extensively been using `Joomla\CMS\MVC\View\AbstractView::get()` in all views. From 5.3 onwards,
27+
this method is deprecated and is going to be removed in Joomla 7.0.
2728

2829
This code in the past was used to retrieve data from the model. It was included in the `HtmlView.php` and often looked like this:
2930
```php
@@ -35,9 +36,12 @@ public function display($tpl = null)
3536
parent::display($tpl);
3637
}
3738
```
38-
This code in the view called the method `get<FirstArgument>` on the model and returned the result. If the model didn't have such a method, it returned the classes attribute named by the first argument.
39+
This code in the view called the method `get<FirstArgument>` on the model and returned the result. If the model didn't have such a method,
40+
it returned the classes attribute named by the first argument.
41+
42+
The downside of this is an indirection which no IDE and static code analyser can understand and which hides errors. The better
43+
solution is to call the model directly, making it easy for an IDE to understand the code. The new code should look like this:
3944

40-
The downside of this is an indirection which no IDE and static code analyser can understand and which hides errors. The better solution is to call the model directly, making it easy for an IDE to understand the code. The new code should look like this:
4145
```php
4246
public function display($tpl = null)
4347
{
@@ -49,7 +53,10 @@ public function display($tpl = null)
4953
parent::display($tpl);
5054
}
5155
```
52-
The first line is a docblock comment, which provides a hint for the IDE for the actual model that is used. The second line will retrieve the model set in the view. If you have more than one model in a view, you can provide it with a parameter to select the right model. The last two lines retrieve the actual data from the model. With the first two lines, IDEs can hint at the available methods in the model and now the returned values from those methods, making it possible to find issues further down the line.
56+
The first line is a docblock comment, which provides a hint for the IDE for the actual model that is used.
57+
The second line will retrieve the model set in the view. If you have more than one model in a view, you can provide it with a parameter to select the right model.
58+
The last two lines retrieve the actual data from the model. With the first two lines, IDEs can hint at the available methods in the model
59+
and now the returned values from those methods, making it possible to find issues further down the line.
5360

5461
## Deprecate `HTMLHelper::_('script')`, `HTMLHelper::_('stylesheet')`
5562

@@ -61,7 +68,20 @@ PR: https://github.com/joomla/joomla-cms/pull/43396
6168
Deprecate the namespace property of the ComponentRecord class. The property were never initialised.
6269
PR: https://github.com/joomla/joomla-cms/pull/44754
6370

71+
72+
## Plugins deprecations
73+
74+
### CMSPlugin: Deprecate use of DispatcherAware and LanguageAware
75+
76+
Plugin should use DispatcherAware on its own, when it needs to dispatch an event, like for example content/finder.
77+
And language cannot be set on plugin while plugin booting, because it is not available until initialisation of the application is completed.
78+
79+
PR: https://github.com/joomla/joomla-cms/pull/43430
80+
6481
## Dependency Deprecations
6582

6683
### TYPO3/phar-stream-wrapper
67-
PHP 7 had a security issue with .phar packages. To circumvent the issue, the TYPO3 project created this wrapper. In PHP 8.0 this has been fixed in PHP and the whole wrapper is not needed anymore. This package will be removed in 6.0.
84+
85+
PHP 7 had a security issue with .phar packages. To circumvent the issue, the TYPO3 project created this wrapper.
86+
In PHP 8.0 this has been fixed in PHP and the whole wrapper is not needed anymore. This package will be removed in 6.0.
87+

0 commit comments

Comments
 (0)