Commit 8a119296 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] Move class RecordList to Controller/RecordListController

Class TYPO3\CMS\Recordlist\RecordList is the list module
main controller and thus should be rename to
TYPO3\CMS\Recordlist\Controller\RecordListController

Resolves: #84399
Releases: master
Change-Id: I77ca1c2f9841e234bde2dd571d8875db5c0e0b14
Reviewed-on: https://review.typo3.org/56275


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent a7b18059
......@@ -86,6 +86,7 @@
"typo3/sysext/fluid/Migrations/Code/ClassAliasMap.php",
"typo3/sysext/info/Migrations/Code/ClassAliasMap.php",
"typo3/sysext/lowlevel/Migrations/Code/ClassAliasMap.php",
"typo3/sysext/recordlist/Migrations/Code/ClassAliasMap.php",
"typo3/sysext/reports/Migrations/Code/ClassAliasMap.php",
"typo3/sysext/saltedpasswords/Migrations/Code/ClassAliasMap.php",
"typo3/sysext/workspaces/Migrations/Code/ClassAliasMap.php"
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "c2fe666b163be8ccee13df7d63c794cc",
"content-hash": "33161a8bc06421b8de725e3dfb422fae",
"packages": [
{
"name": "cogpowered/finediff",
......
......@@ -39,7 +39,6 @@ use TYPO3\CMS\Core\Versioning\VersionState;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
use TYPO3\CMS\Frontend\Page\PageRepository;
use TYPO3\CMS\Recordlist\RecordList;
/**
* Script Class for Web > Layout module
......@@ -260,7 +259,7 @@ class PageLayoutController
$this->MCONF['name'] = $this->moduleName;
$this->perms_clause = $this->getBackendUser()->getPagePermsClause(Permission::PAGE_SHOW);
// Get session data
$sessionData = $this->getBackendUser()->getSessionData(RecordList::class);
$sessionData = $this->getBackendUser()->getSessionData(__CLASS__);
$this->search_field = !empty($sessionData['search_field']) ? $sessionData['search_field'] : '';
// GPvars:
$this->id = (int)GeneralUtility::_GP('id');
......@@ -274,7 +273,7 @@ class PageLayoutController
$this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
$sessionData['search_field'] = $this->search_field;
// Store session data
$this->getBackendUser()->setAndSaveSessionData(RecordList::class, $sessionData);
$this->getBackendUser()->setAndSaveSessionData(__CLASS__, $sessionData);
// Load page info array:
$this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
// Initialize menu
......
......@@ -2680,7 +2680,6 @@ class PageLayoutView implements LoggerAwareInterface
* Initializes the clipboard for generating paste links
*
*
* @see \TYPO3\CMS\Recordlist\RecordList::main()
* @see \TYPO3\CMS\Backend\Controller\ContextMenuController::clipboardAction()
* @see \TYPO3\CMS\Filelist\Controller\FileListController::indexAction()
*/
......
.. include:: ../../Includes.txt
======================================================================
Deprecation: #84399 - Class RecordList renamed to RecordListController
======================================================================
See :issue:`84399`
Description
===========
The PHP class :php:`TYPO3\CMS\Recordlist\RecordList` has been renamed to
:php:`TYPO3\CMS\Recordlist\Controller\RecordListController`
Impact
======
The old class name has been registered as class alias and will still work.
Old class name usage however is discouraged and should be avoided since, the
alias will vanish with core version 10.
Affected Installations
======================
Extensions that hook into the list module may be affected if type hinting
with the old classes as :php:`$parentObject`.
The extension scanner will find affected extensions using the old class name.
Migration
=========
Use new class name instead.
.. index:: Backend, PHP-API, FullyScanned, ext:recordlist
\ No newline at end of file
......@@ -654,4 +654,9 @@ return [
'Deprecation-84109-DeprecateDependencyResolver.rst',
],
],
'TYPO3\CMS\Recordlist\RecordList' => [
'restFiles' => [
'Deprecation-84399-ClassRecordListRenamedToRecordListController.rst',
],
],
];
<?php
namespace TYPO3\CMS\Recordlist;
namespace TYPO3\CMS\Recordlist\Controller;
/*
* This file is part of the TYPO3 CMS project.
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Recordlist;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
......@@ -36,11 +37,12 @@ use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;
/**
* Script Class for the Web > List module; rendering the listing of records on a page
*/
class RecordList
class RecordListController
{
/**
* Page Id for which to make the listing
......@@ -310,10 +312,8 @@ class RecordList
}
// Initialize the dblist object:
/** @var $dblist RecordList\DatabaseRecordList */
$dblist = GeneralUtility::makeInstance(RecordList\DatabaseRecordList::class);
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$dblist = GeneralUtility::makeInstance(DatabaseRecordList::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$dblist->script = (string)$uriBuilder->buildUriFromRoute('web_list');
$dblist->calcPerms = $calcPerms;
$dblist->thumbs = $backendUser->uc['thumbnailsByDefault'];
......@@ -722,8 +722,7 @@ class RecordList
'justLocalized' => 'pages:' . $id . ':' . $languageUid,
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
];
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$redirectUrl = (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters);
$targetUrl = BackendUtility::getLinkToDataHandlerAction(
'&cmd[pages][' . $id . '][localize]=' . $languageUid,
......
<?php
return [
'TYPO3\\CMS\\Recordlist\\RecordList' => \TYPO3\CMS\Recordlist\Controller\RecordListController::class,
];
<?php
namespace {
die('Access denied');
}
namespace TYPO3\CMS\Recordlist {
/**
* @deprecated since v9, will be removed in v10
*/
class RecordList extends \TYPO3\CMS\Recordlist\Controller\RecordListController
{
}
}
......@@ -30,6 +30,11 @@
"partOfMinimalUsableSystem": true
},
"extension-key": "recordlist"
},
"typo3/class-alias-loader": {
"class-alias-maps": [
"Migrations/Code/ClassAliasMap.php"
]
}
},
"autoload": {
......
......@@ -7,7 +7,7 @@ defined('TYPO3_MODE') or die();
'',
'',
[
'routeTarget' => \TYPO3\CMS\Recordlist\RecordList::class . '::mainAction',
'routeTarget' => \TYPO3\CMS\Recordlist\Controller\RecordListController::class . '::mainAction',
'access' => 'user,group',
'name' => 'web_list',
'icon' => 'EXT:recordlist/Resources/Public/Icons/module-list.svg',
......
......@@ -16,6 +16,7 @@ namespace TYPO3\CMS\SysNote\Hook;
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Recordlist\Controller\RecordListController;
use TYPO3\CMS\SysNote\Controller\NoteController;
use TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository;
......@@ -28,10 +29,10 @@ class RecordListHook
* Add sys_notes as additional content to the header of the list module
*
* @param array $params
* @param \TYPO3\CMS\Recordlist\RecordList $parentObject
* @param RecordListController $parentObject
* @return string
*/
public function renderInHeader(array $params = [], \TYPO3\CMS\Recordlist\RecordList $parentObject)
public function renderInHeader(array $params = [], RecordListController $parentObject)
{
$controller = GeneralUtility::makeInstance(NoteController::class);
return $controller->listAction($parentObject->id, SysNoteRepository::SYS_NOTE_POSITION_TOP);
......@@ -41,10 +42,10 @@ class RecordListHook
* Add sys_notes as additional content to the footer of the list module
*
* @param array $params
* @param \TYPO3\CMS\Recordlist\RecordList $parentObject
* @param RecordListController $parentObject
* @return string
*/
public function renderInFooter(array $params = [], \TYPO3\CMS\Recordlist\RecordList $parentObject)
public function renderInFooter(array $params = [], RecordListController $parentObject)
{
$controller = GeneralUtility::makeInstance(NoteController::class);
return $controller->listAction($parentObject->id, SysNoteRepository::SYS_NOTE_POSITION_BOTTOM);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment