Commit 6e8b4f0e authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Benni Mack
Browse files

[!!!][TASK] Remove RecordList hooks and interface

The RecordList hooks, used to modify the actions,
icons and labels in the DatabaseRecordList are
superseded by modern PSR-14 events.

Therefore, the hooks and the interface are now removed.

Resolves: #96169
Related: #96169
Releases: main
Change-Id: Id706b1d8136399720c0121fbbc1e51488763fd8d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72432

Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 6cdcfad8
......@@ -33,6 +33,7 @@ The following PHP classes that have previously been marked as deprecated for v11
The following PHP interfaces that have previously been marked as deprecated for v11 and were now removed:
- :php:`\TYPO3\CMS\Core\Resource\Hook\FileDumpEIDHookInterface`
- :php:`\TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface`
The following PHP class aliases that have previously been marked as deprecated for v11 and were now removed:
......@@ -153,6 +154,7 @@ The following hooks have been removed:
- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess']`
- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering']`
- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions']`
- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']`
The following single field configurations have been removed from TCA:
......
......@@ -528,6 +528,7 @@ return [
'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'typo3/class.db_list_extra.inc\'][\'actions\']' => [
'restFiles' => [
'Deprecation-95105-DatabaseRecordListHooks.rst',
'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
],
],
'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'typo3/browse_links.php\'][\'browserRendering\']' => [
......
......@@ -1835,6 +1835,7 @@ return [
'TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface' => [
'restFiles' => [
'Deprecation-95105-DatabaseRecordListHooks.rst',
'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
],
],
'\TYPO3\CMS\Fluid\ViewHelpers\Uri\EmailViewHelper' => [
......
......@@ -1320,29 +1320,6 @@ class DatabaseRecordList
}
}
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
trigger_error(
'The hook $TYPO3_CONF_VARS[SC_OPTIONS][typo3/class.db_list_extra.inc][actions] for calling method "renderListHeader" is deprecated and will stop working in TYPO3 v12.0. Use the ModifyRecordListHeaderColumnsEvent instead.',
E_USER_DEPRECATED
);
}
/*
* hook: renderListHeader: Allows to change the contents of columns/cells of the Web>List table headers
* usage: Above each listed table in Web>List a header row is shown.
* Containing the labels of all shown fields and additional icons to create new records for this
* table or perform special clipboard tasks like mark and copy all listed records to clipboard, etc.
*
* @deprecated in v11, will be removed in TYPO3 v12.0.
*/
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] ?? [] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof RecordListHookInterface) {
throw new \UnexpectedValueException($className . ' must implement interface ' . RecordListHookInterface::class, 1195567855);
}
$theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this);
}
$event = $this->eventDispatcher->dispatch(
new ModifyRecordListHeaderColumnsEvent($theData, $table, $currentIdList, $this)
);
......@@ -1740,48 +1717,6 @@ class DatabaseRecordList
$this->addActionToCellGroup($cells, $stat, 'stat');
}
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
trigger_error(
'The hook $TYPO3_CONF_VARS[SC_OPTIONS][typo3/class.db_list_extra.inc][actions] for calling method "makeControl" is deprecated and will stop working in TYPO3 v12.0. Use the ModifyRecordListRecordActionsEvent instead.',
E_USER_DEPRECATED
);
}
/*
* hook: makeControl: Allows to change control icons of records in list-module
* usage: This hook method gets passed the current $cells array as third parameter.
* This array contains values for the icons/actions generated for each record in Web>List.
* Each array entry is accessible by an index-key.
* The order of the icons is depending on the order of those array entries.
*
* @deprecated in v11, will be removed in TYPO3 v12.0.
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] ?? false)) {
// for compatibility reason, we move all icons to the rootlevel
// before calling the hooks
foreach ($cells as $section => $actions) {
foreach ($actions as $actionKey => $action) {
$cells[$actionKey] = $action;
}
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof RecordListHookInterface) {
throw new \UnexpectedValueException($className . ' must implement interface ' . RecordListHookInterface::class, 1195567840);
}
$cells = $hookObject->makeControl($table, $row, $cells, $this);
}
// now sort icons again into primary and secondary sections
// after all hooks are processed
$hookCells = $cells;
foreach ($hookCells as $key => $value) {
if ($key === 'primary' || $key === 'secondary') {
continue;
}
$this->addActionToCellGroup($cells, $value, $key);
}
}
// Add clipboard related actions
$this->makeClip($table, $row, $cells);
......@@ -1923,32 +1858,6 @@ class DatabaseRecordList
</button>';
}
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
trigger_error(
'The hook $TYPO3_CONF_VARS[SC_OPTIONS][typo3/class.db_list_extra.inc][actions] for calling method "makeClip" is deprecated and will stop working in TYPO3 v12.0. Use the ModifyRecordListRecordActionsEvent instead.',
E_USER_DEPRECATED
);
}
/*
* hook: makeClip: Allows to change clip-icons of records in list-module
* usage: This hook method gets passed the current $cells array as third parameter.
* This array contains values for the clipboard icons generated for each record in Web>List.
* Each array entry is accessible by an index-key.
* The order of the icons is depending on the order of those array entries.
*
* @deprecated in v11, will be removed in TYPO3 v12.0.
*/
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] ?? false)) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof RecordListHookInterface) {
throw new \UnexpectedValueException($className . ' must implement interface ' . RecordListHookInterface::class, 1195567845);
}
$clipboardCells = $hookObject->makeClip($table, $row, $clipboardCells, $this);
}
}
// Add the clipboard actions to the cell group
foreach ($clipboardCells as $key => $value) {
if ($key === 'primary' || $key === 'secondary') {
......@@ -3351,32 +3260,10 @@ class DatabaseRecordList
}
}
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
trigger_error(
'The hook $TYPO3_CONF_VARS[SC_OPTIONS][typo3/class.db_list_extra.inc][actions] for calling method "renderListHeaderActions" is deprecated and will stop working in TYPO3 v12.0. Use the ModifyRecordListTableActionsEvent instead.',
E_USER_DEPRECATED
);
}
/*
* hook: renderListHeaderActions: Allows to influence the table header actions
* usage: Above each listed table in Web>List a header row is shown.
* This hook allows to modify the icons responsible for the clipboard functions
* or other "Action" functions which perform operations on the listed records.
*
* @deprecated in v11, will be removed in TYPO3 v12.0.
*/
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] ?? [] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof RecordListHookInterface) {
throw new \UnexpectedValueException($className . ' must implement interface ' . RecordListHookInterface::class, 1195567850);
}
$actions = $hookObject->renderListHeaderActions($table, $currentIdList, $actions, $this);
}
$event = $this->eventDispatcher->dispatch(
new ModifyRecordListTableActionsEvent($actions, $table, $currentIdList, $this)
);
/** @var array<string, string> $actions */
$actions = $event->getActions();
if ($actions === []) {
......
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Recordlist\RecordList;
/**
* Interface for classes which hook into \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList and modify clip-icons
* @deprecated since TYPO3 v11 LTS, will be removed in TYPO3 v12.0. Use the PSR-14-based events instead.
*/
interface RecordListHookInterface
{
/**
* Modifies Web>List clip icons (copy, cut, paste, etc.) of a displayed row
*
* @param string $table The current database table
* @param array $row The current record row
* @param array $cells The default clip-icons to get modified
* @param object $parentObject Instance of calling object
* @return array The modified clip-icons
* @deprecated since v11, will be removed in v12. Use ModifyRecordListRecordActionsEvent instead.
*/
public function makeClip($table, $row, $cells, &$parentObject);
/**
* Modifies Web>List control icons of a displayed row
*
* @param string $table The current database table
* @param array $row The current record row
* @param array $cells The default control-icons to get modified
* @param object $parentObject Instance of calling object
* @return array The modified control-icons
* @deprecated since v11, will be removed in v12. Use ModifyRecordListRecordActionsEvent instead.
*/
public function makeControl($table, $row, $cells, &$parentObject);
/**
* Modifies Web>List header row columns/cells
*
* @param string $table The current database table
* @param array $currentIdList Array of the currently displayed uids of the table
* @param array $headerColumns An array of rendered cells/columns
* @param object $parentObject Instance of calling (parent) object
* @return array Array of modified cells/columns
* @deprecated since v11, will be removed in v12. Use ModifyRecordListHeaderColumnsEvent instead.
*/
public function renderListHeader($table, $currentIdList, $headerColumns, &$parentObject);
/**
* Modifies Web>List header row clipboard/action icons
*
* @param string $table The current database table
* @param array $currentIdList Array of the currently displayed uids of the table
* @param array $cells An array of the current clipboard/action icons
* @param object $parentObject Instance of calling (parent) object
* @return array Array of modified clipboard/action icons
* @deprecated since v11, will be removed in v12. Use ModifyRecordListTableActionsEvent instead.
*/
public function renderListHeaderActions($table, $currentIdList, $cells, &$parentObject);
}
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