Deprecation: #86198 - Protected RecordListController¶
See forge#86198
Description¶
The following properties of class TYPO3\CMS\Recordlist\Controller\RecordListController
changed their visibility from public
to protected and should not be called any longer:
id
pointer
table
search_field
search_levels
showLimit
returnUrl
clear_cache
cmd
cmd_table
perms_clause
pageinfo
MOD_MENU
content
body
imagemode
doc
The following methods of class TYPO3\CMS\Recordlist\Controller\RecordListController
changed their visibility from public
to protected and should not be called any longer:
init()
menuConfig()
clearCache()
main()
getModuleTemplate()
Additionally, the two hooks
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawHeaderHook']
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawFooterHook']
changed their signature:
The second argument, an instance of the parent object RecordListController
will be removed in TYPO3 v10. Use the instance of the PSR-7
ServerRequestInterface
that is provided as array key request
of the first argument.
Furthermore, the assignment of an object instance of class RecordListController
as
GLOBALS['SOBE']
has been marked as deprecated and will not be set anymore in TYPO3 v10.
Impact¶
Calling one of the above methods or accessing above properties will trigger a PHP E_USER_DEPRECATED
error.
Affected Installations¶
Instances are usually only affected if an extension registers a hook for
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawHeaderHook']
or
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawFooterHook']
. They will
work as before in TYPO3 v9, but using a property or calling a method of the provided parent object will trigger a PHP E_USER_DEPRECATED
error.
Migration¶
Hooks registered should change their parent object usage and signature. An example can be found in the sys_notes
extension
in class TYPO3\CMS\SysNote\Hook\RecordListHook
.
Code before:
/**
* Add sys_notes as additional content to the header of the list module
*
* @param array $params
* @param RecordListController $parentObject
* @return string
*/
public function renderInHeader(array $params = [], RecordListController $parentObject)
{
$controller = GeneralUtility::makeInstance(NoteController::class);
return $controller->listAction($parentObject->id, SysNoteRepository::SYS_NOTE_POSITION_TOP);
}
Adapted hook usage:
/**
* Add sys_notes as additional content to the header of the list module
*
* @param array $params
* @return string
*/
public function renderInHeader(array $params): string
{
/** @var ServerRequestInterface $request */
$request = $params['request'];
$id = (int)($request->getParsedBody()['id'] ?? $request->getQueryParams()['id'] ?? 0);
$controller = GeneralUtility::makeInstance(NoteController::class);
return $controller->listAction($id, SysNoteRepository::SYS_NOTE_POSITION_TOP);
}