[BUGFIX] Change visibility of two properties to public
[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->pageinfo`
26 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->MOD_MENU`
27 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->content`
28 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->body`
29 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->imagemode`
30 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->doc`
31
32 The following methods changed their visibility from public to protected and should not be called any longer:
33
34 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->init()`
35 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->menuConfig()`
36 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->clearCache()`
37 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->main()`
38 * :php:`TYPO3\CMS\Recordlist\Controller\RecordListController->getModuleTemplate()`
39
40 Additionally, the two hooks :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawHeaderHook']`
41 and :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawFooterHook']` changed their signature:
42 The second argument, an instance of the parent object :php:`RecordListController` will be dropped in v10, instead, an instance of the PSR-7
43 :php:`ServerRequestInterface` is provided as array key :php:`request` of the first argument.
44
45 Furthermore, the assignment of an object instance of class :php:`RecordListController` as
46 :php:`GLOBALS['SOBE']` has been deprecated and will not be set anymore in TYPO3 v10.
47
48
49 Impact
50 ======
51
52 Calling one of the above methods or accessing above properties triggers a PHP :php:`E_USER_DEPRECATED` error.
53
54
55 Affected Installations
56 ======================
57
58 Instances are usually only affected if an extension registers a hook for
59 :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawHeaderHook']` or
60 :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/Modules/Recordlist/index.php']['drawFooterHook']`. They will
61 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.
62
63
64 Migration
65 =========
66
67 Hooks registered should change their parent object usage and signature. An example can be found in the `sys_notes` extension
68 in class :php:`TYPO3\CMS\SysNote\Hook\RecordListHook`
69
70 Code before::
71
72 /**
73 * Add sys_notes as additional content to the header of the list module
74 *
75 * @param array $params
76 * @param RecordListController $parentObject
77 * @return string
78 */
79 public function renderInHeader(array $params = [], RecordListController $parentObject)
80 {
81 $controller = GeneralUtility::makeInstance(NoteController::class);
82 return $controller->listAction($parentObject->id, SysNoteRepository::SYS_NOTE_POSITION_TOP);
83 }
84
85 Adapted hook usage::
86
87 /**
88 * Add sys_notes as additional content to the header of the list module
89 *
90 * @param array $params
91 * @return string
92 */
93 public function renderInHeader(array $params): string
94 {
95 /** @var ServerRequestInterface $request */
96 $request = $params['request'];
97 $id = (int)($request->getParsedBody()['id'] ?? $request->getQueryParams()['id'] ?? 0);
98 $controller = GeneralUtility::makeInstance(NoteController::class);
99 return $controller->listAction($id, SysNoteRepository::SYS_NOTE_POSITION_TOP);
100 }
101
102
103 .. index:: Backend, PHP-API, NotScanned, ext:recordlist