Breaking: #92609 - Use controller classes when registering plugins/modules¶
See forge#92609
Description¶
Configuring plugins and modules via the following methods has changed in two important ways.
\TYPO3\
CMS\ Extbase\ Utility\ Extension Utility:: configure Plugin \TYPO3\
CMS\ Extbase\ Utility\ Extension Utility:: register Module
Both methods expect to be provided with the arguments $extension
and $controller
.
configure
also allows the argument $non
.
The first important change targets the $extension
argument.
During the switch from underscore class names Tx_
to actual namespaced classes
\TYPO3\
, a vendor TYPO3\
has been introduced which had to be respected
during the configuration of plugins. To make that possible the argument $extension
has been
prepended with the vendor name, concatenated with dots.
Before:
<?php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'TYPO3.CMS.Form', // $extensionName
'Formframework',
['FormFrontend' => 'render, perform'],
['FormFrontend' => 'perform'],
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);
Setting the vendor name has been marked as deprecated and must be omitted. Instead, the vendor name will be derived from the controller class namespace, which leads to the second important change.
Both arguments $controller
and $non
used controller aliases as
array keys. The alias was the controller class name without the namespace and without the Controller
suffix. There were a lot of conventions and a custom autoloader mechanism before the introduction
of the composer autoloader, which made it necessary to put controllers in a specific directory and to name
the controller accordingly. As this is no longer the case, there is no need to guess the controller class name
any longer. Instead, the configuration/registration is now done with fully qualified controller class names.
After:
<?php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Form',
'Formframework',
[\TYPO3\CMS\Form\Controller\FormFrontendController::class => 'render, perform'],
[\TYPO3\CMS\Form\Controller\FormFrontendController::class => 'perform'],
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
);
Impact¶
Using non fully qualified class names during plugin/module registration will lead to malfunctioning plugins/modules at best. Probably an Exception will be thrown or a fatal error occurs during plugin/module dispatching.
Affected Installations¶
All installations that use these methods:
\TYPO3\
CMS\ Extbase\ Utility\ Extension Utility:: configure Plugin () \TYPO3\
CMS\ Extbase\ Utility\ Extension Utility:: register Module ()
Migration¶
- Omit the vendor name in argument
$extension
Name - Use fully qualified class names as array keys in arguments
$controller
andActions $non
Cacheable Controller Actions