Commit e81619ee authored by Daniel Siepmann's avatar Daniel Siepmann Committed by Georg Ringer
Browse files

[BUGFIX] Render exception for backend preview as error

Prior only an warning was logged, and a fallback rendering jumped in.
With this change an error is rendered in addition to logging. No
fallback will be triggered anymore.

This should raise awareness and ease integration for integrators.
Please note that already broken elements might now show an error
instead of fallback preview.

This is only activated for admin users and enabled BE|debug system
setting.

Resolves: #90427
Releases: master
Change-Id: I1f24a1e775ba4f12917ed26dc29b0ea78ab81a1f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63318


Reviewed-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
Reviewed-by: Björn Jacob's avatarBjörn Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarChristian Eßl <indy.essl@gmail.com>
Reviewed-by: default avatarIngo Fabbri <ingo.fabbri@gmail.com>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarChristian Eßl <indy.essl@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 1c7826d5
......@@ -26,6 +26,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\Event\AfterSectionMarkupGeneratedEvent;
use TYPO3\CMS\Backend\View\Event\BeforeSectionMarkupGeneratedEvent;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
......@@ -1243,11 +1244,22 @@ class PageLayoutView implements LoggerAwareInterface
$fluidTemplateFile,
$e->getMessage()
));
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] && $this->getBackendUser()->isAdmin()) {
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->assign('error', [
'message' => str_replace(Environment::getProjectPath(), '', $e->getMessage()),
'title' => 'Error while rendering FluidTemplate preview using ' . str_replace(Environment::getProjectPath(), '', $fluidTemplateFile),
]);
$view->setTemplateSource('<f:be.infobox title="{error.title}" state="2">{error.message}</f:be.infobox>');
return $view->render();
}
}
}
}
return null;
}
/**
* Renders the preview part of a content element
* @param array $row given tt_content database record
......
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