71f3d02a6bd3ca0669f19d2aabb0c8110facee04
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / master / Deprecation-86198-ProtectedRecordListController.rst
1 .. include:: ../../Includes.txt
2
3 ====================================================
4 Deprecation: #86198 - Protected RecordListController
5 ====================================================
6
7 See :issue:`86198`
8
9 Description
10 ===========
11
12 The following properties changed their visibility from public to protected and should not be called any longer:
13
14 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->id`
15 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->pointer`
16 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->table`
17 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->search_field`
18 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->search_levels`
19 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->showLimit`
20 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->returnUrl`
21 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->clear_cache`
22 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->cmd`
23 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->cmd_table`
24 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->perms_clause`
25 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->modTSconfig`
26 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->pageinfo`
27 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->MOD_MENU`
28 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->MOD_SETTINGS`
29 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->content`
30 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->body`
31 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->imagemode`
32 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->doc`
33
34 The following methods changed their visibility from public to protected and should not be called any longer:
35
36 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->init()`
37 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->menuConfig()`
38 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->clearCache()`
39 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->main()`
40 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->getModuleTemplate()`
41
42 Additionally, the two hooks :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawHeaderHook']`
43 and :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawFooterHook']` changed their signature:
44 The second argument, an instance of the parent object :php:`RecordListController` will be dropped in v10, instead, an instance of the PSR-7
45 :php:`ServerRequestInterface` is provided as array key :php:`request` of the first argument.
46
47 Furthermore, the assignment of an object instance of class :php:`RecordListController` as
48 :php:`GLOBALS['SOBE']` has been deprecated and will not be set anymore in TYPO3 v10.
49
50
51 Impact
52 ======
53
54 Calling one of the above methods or accessing above properties triggers a PHP :php:`E_USER_DEPRECATED` error.
55
56
57 Affected Installations
58 ======================
59
60 Instances are usually only affected if an extension registers a hook for
61 :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawHeaderHook']` or
62 :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawFooterHook']`. They will
63 work as before in v9, but using a property or calling a method of the provided parent object triggers a PHP :php:`E_USER_DEPRECATED` error.
64
65
66 Migration
67 =========
68
69 Hooks registered should change their parent object usage and signature. An example can be found in the `sys_notes` extension
70 in class :php:`TYPO3\CMS\SysNote\Hook\RecordListHook`
71
72 Code before::
73
74     /**
75      * Add sys_notes as additional content to the header of the list module
76      *
77      * @param array $params
78      * @param RecordListController $parentObject
79      * @return string
80      */
81     public function renderInHeader(array $params = [], RecordListController $parentObject)
82     {
83         $controller = GeneralUtility::makeInstance(NoteController::class);
84         return $controller->listAction($parentObject->id, SysNoteRepository::SYS_NOTE_POSITION_TOP);
85     }
86
87 Adapted hook usage::
88
89     /**
90      * Add sys_notes as additional content to the header of the list module
91      *
92      * @param array $params
93      * @return string
94      */
95     public function renderInHeader(array $params): string
96     {
97         /** @var ServerRequestInterface $request */
98         $request = $params['request'];
99         $id = (int)($request->getParsedBody()['id'] ?? $request->getQueryParams()['id'] ?? 0);
100         $controller = GeneralUtility::makeInstance(NoteController::class);
101         return $controller->listAction($id, SysNoteRepository::SYS_NOTE_POSITION_TOP);
102     }
103
104
105 .. index:: Backend, PHP-API, NotScanned, ext:recordlist