Skip to content
Snippets Groups Projects
Commit d2493f3a authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] Extract a hardcoded fluid template source to file

Hard coded fluid code within the framework (except
in fluid view helper tests) is not a good thing:
It makes substituting the view with something
else impossible.
The patch extracts a setTemplateSource() to a file.
This is a pre-patch to a general view factory
implementation.

Resolves: #104769
Releases: main
Change-Id: Ifb95e274a276b15c882694735ccda4cdcb2130d9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85821


Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
parent 5e100d0a
Branches
Tags
No related merge requests found
......@@ -99,14 +99,13 @@ final class FluidBasedContentPreviewRenderer implements LoggerAwareInterface
'file' => $fluidTemplateFileAbsolutePath,
'exception' => $e,
]);
if ($this->getBackendUser()->shallDisplayDebugInformation()) {
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename('EXT:backend/Resources/Private/Templates/PageLayout/FluidBasedContentPreviewRenderingException.html');
$view->assign('error', [
'message' => str_replace(Environment::getProjectPath(), '', $e->getMessage()),
'title' => 'Error while rendering FluidTemplate preview using ' . str_replace(Environment::getProjectPath(), '', $fluidTemplateFileAbsolutePath),
]);
$view->setTemplateSource('<f:be.infobox title="{error.title}" state="{f:constant(name: \'TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper::STATE_ERROR\')}">{error.message}</f:be.infobox>');
return $view->render();
}
return null;
......
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:be.infobox
title="{error.title}"
state="{f:constant(name: 'TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper::STATE_ERROR')}"
>
{error.message}
</f:be.infobox>
</html>
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