Commit edf20a9a authored by crell's avatar crell Committed by Stefan Bürk
Browse files

[!!!][TASK] Remove the not-useful hooks from EditFileController

Per the existing todo messages, these hooks are not useful and
better alternatives already exist. There's therefore no need
to set up events to replace them.

Resolves: #97452
Related: #96753
Releases: main
Change-Id: I07a9163da4be31263b818f24e6c43b658474be09
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74413


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent 9202450c
.. include:: /Includes.rst.txt
===================================================
Breaking: #97452 - Removed EditFileController hooks
===================================================
See :issue:`97452`
Description
===========
The hooks :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook']` and
:php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook']` have been removed.
The same behavior may be achieved using template overrides.
Impact
======
Any hook implementation registered is not executed anymore in TYPO3 v12.0+.
The extension scanner will report possible usages.
Affected Installations
======================
All TYPO3 installations using these hook in custom extension code. This is pretty
unlikely, since both hooks were of limited use.
Migration
=========
The content preparation allowed by :php:`preOutputProcessingHook` can be achieved with
:ref:`FormEngine data providers <t3coreapi:FormEngine-DataCompiling>`.
The content manipulation :php:`postOutputProcessingHook` hook can be substituted with a template override
as outlined in :doc:`this changelog entry <Feature-96812-OverrideBackendTemplatesWithTSconfig>`.
.. index:: Backend, PHP-API, FullyScanned, ext:backend
......@@ -140,14 +140,6 @@ class EditFileController
$dataColumnDefinition = $this->dataColumnTca;
$dataColumnDefinition['label'] = htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:file')) . ' ' . htmlspecialchars($combinedIdentifier);
// @todo: Consider dropping this hook. Working on $content is useless here and
// overriding $dataColumnDefinition could be done via FormEngine.
$hookContent = '';
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'] ?? [] as $hookFunction) {
$hookParameters = ['content' => &$hookContent, 'target' => &$combinedIdentifier, 'dataColumnDefinition' => &$dataColumnDefinition];
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
$formData = $this->formEngineData;
$formData['databaseRow']['data'] = $file->getContents();
$formData['databaseRow']['target'] = $file->getUid();
......@@ -162,21 +154,10 @@ class EditFileController
$view->assignMultiple([
'moduleUrlTceFile' => (string)$this->uriBuilder->buildUriFromRoute('tce_file'),
'fileName' => $file->getName(),
'hookContent' => $hookContent,
'form' => $formResultCompiler->addCssFiles() . $resultArray['html'] . $formResultCompiler->printNeededJSFunctions(),
]);
$content = $view->render('File/EditFile');
// @todo: Consider dropping this hook: Working late on content could be done via template override or FormEngine
// and overriding $combinedIdentifier is useless here.
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'] ?? [] as $hookFunction) {
$hookParameters = [
'pageContent' => &$content,
'target' => &$combinedIdentifier,
];
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
return $this->responseFactory->createResponse()
->withHeader('Content-Type', 'text/html; charset=utf-8')
->withBody($this->streamFactory->createStream($content));
......
......@@ -901,4 +901,14 @@ return [
'Feature-98375-PSR-14EventsInPageModule.rst',
],
],
'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'typo3/file_edit.php\'][\'preOutputProcessingHook\']' => [
'restFiles' => [
'Breaking-97452-RemovedEditFileControllerHooks.rst',
],
],
'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'typo3/file_edit.php\'][\'postOutputProcessingHook\']' => [
'restFiles' => [
'Breaking-97452-RemovedEditFileControllerHooks.rst',
],
],
];
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