Commit 1eca31f3 authored by Michael Oehlhof's avatar Michael Oehlhof Committed by Anja Leichsenring
Browse files

[!!!][TASK] Fluidification of EditFileController

Resolves: #78759
Releases: master
Change-Id: I2ba72aeda6d56610cc4977f222abe26d124b7f15
Reviewed-on: https://review.typo3.org/50722

Reviewed-by: default avatarGleb Levitin <gleb.levitin@dkd.de>
Tested-by: default avatarGleb Levitin <gleb.levitin@dkd.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent e95cb0f4
......@@ -24,6 +24,7 @@ use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
/**
* Script Class for rendering the file editing screen
......@@ -144,7 +145,7 @@ class EditFileController extends AbstractModule
public function main()
{
$this->getButtons();
// Hook before compiling the output
// Hook: before compiling the output
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'])) {
$preOutputProcessingHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'];
if (is_array($preOutputProcessingHook)) {
......@@ -158,12 +159,10 @@ class EditFileController extends AbstractModule
}
}
$pageContent = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" id="EditFileController" name="editform">';
$pageContent .= '<h1>'
. $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle')
. ' ' . htmlspecialchars($this->fileObject->getName()) . '</h1>';
$assigns = [];
$assigns['moduleUrlTceFile'] = BackendUtility::getModuleUrl('tce_file');
$assigns['fileName'] = $this->fileObject->getName();
$code = '';
$extList = $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'];
try {
if (!$extList || !GeneralUtility::inList($extList, $this->fileObject->getExtension())) {
......@@ -178,24 +177,24 @@ class EditFileController extends AbstractModule
'target' => $this->origTarget,
'returnUrl' => $this->returnUrl
]);
$code .= '
<div id="c-edit">
<textarea rows="30" name="file[editfile][0][data]" wrap="off" class="form-control text-monospace t3js-enable-tab">' . htmlspecialchars($fileContent) . '</textarea>
<input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" />
<input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" />
</div>
<br />';
$assigns['uid'] = $this->fileObject->getUid();
$assigns['fileContent'] = $fileContent;
$assigns['hValue'] = $hValue;
} catch (\Exception $e) {
$code .= sprintf(
$this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:file_edit.php.coundNot'),
$extList
);
$assigns['extList'] = $extList;
}
// Ending of section and outputting editing form:
$pageContent .= $code;
// Hook after compiling the output
// Rendering of the output via fluid
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplateRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates')]);
$view->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Partials')]);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
'EXT:backend/Resources/Private/Templates/File/EditFile.html'
));
$view->assignMultiple($assigns);
$pageContent = $view->render();
// Hook: after compiling the output
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'])) {
$postOutputProcessingHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'];
if (is_array($postOutputProcessingHook)) {
......@@ -208,9 +207,8 @@ class EditFileController extends AbstractModule
}
}
}
$pageContent .= '</form>';
$this->content = $pageContent;
$this->content .= $pageContent;
$this->moduleTemplate->setContent($this->content);
}
......
<form action="{moduleUrlTceFile}" method="post" id="EditFileController" name="editform">
<h1><f:translate key="LLL:EXT:lang/locallang_core.xlf:file_edit.php.pagetitle" /> {fileName}</h1>
<div id="c-edit">
<textarea rows="30" name="file[editfile][0][data]" wrap="off" class="form-control text-monospace t3js-enable-tab">{fileContent}</textarea>
<input type="hidden" name="file[editfile][0][target]" value="{uid}" />
<input type="hidden" name="redirect" value="{hValue}" />
</div>
<br />
<f:if condition="{extList}">
<f:format.raw>
<f:translate key="LLL:EXT:lang/locallang_core.xlf:file_edit.php.coundNot" arguments="{0: extList}" />
</f:format.raw>
</f:if>
</form>
.. include:: ../../Includes.txt
=======================================================
Breaking: #78759 - Fluidification of EditFileController
=======================================================
See :issue:`78759`
Description
===========
While moving all HTML from PHP code to an own Fluid template the HTML data given to the hook after compiling the output is different now.
Impact
======
The HTML data given to the hook after compiling the output now contains the closing form tag (</form>).
Affected Installations
======================
All installations that append text to the HTML code in the hook after compiling the output.
Migration
=========
The hook code has to be changed to insert additional code before the closing form tag.
.. index:: Backend, Fluid
\ No newline at end of file
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