Skip to content
Snippets Groups Projects
Commit 846abdca authored by Oliver Hader's avatar Oliver Hader Committed by Andreas Fernandez
Browse files

[TASK] Simplify stylesheet and script assignments in ext:form

Avoids round trip through Fluid template, but instead assigns
stylesheets and inline scripts directly via `PageRenderer`.

Resolves: #94969
Releases: master
Change-Id: Ic16c853fc8fcb26204c91b6347616513787fcd78
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70731


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent e33b8875
Branches
Tags
No related merge requests found
......@@ -120,12 +120,9 @@ class FormEditorController extends AbstractBackendController
'maximumUndoSteps' => $this->prototypeConfiguration['formEditor']['maximumUndoSteps'],
];
$this->view->assign('stylesheets', $this->resolveResourcePaths($this->prototypeConfiguration['formEditor']['stylesheets']));
$this->view->assign('formEditorTemplates', $this->renderFormEditorTemplates($formEditorDefinitions));
$this->view->assign('dynamicRequireJsModules', $this->prototypeConfiguration['formEditor']['dynamicRequireJsModules']);
$this->getPageRenderer()->addInlineLanguageLabelFile('EXT:form/Resources/Private/Language/locallang_formEditor_failSafeErrorHandling_javascript.xlf');
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$addInlineSettings = [
'FormEditor' => [
......@@ -143,8 +140,6 @@ class FormEditorController extends AbstractBackendController
$formDefinition['label']
);
$this->view->assign('addInlineSettings', $addInlineSettings);
$formEditorAppInitialData = json_encode($formEditorAppInitialData);
if ($formEditorAppInitialData === false) {
throw new Exception('The form editor app data could not be encoded', 1628677079);
......@@ -158,7 +153,15 @@ class FormEditorController extends AbstractBackendController
viewModel
).run();
});';
$this->getPageRenderer()->addJsInlineCode('formEditorIndex', $script);
$pageRenderer = $this->getPageRenderer();
$pageRenderer->addJsInlineCode('formEditorIndex', $script);
$pageRenderer->addInlineSettingArray(null, $addInlineSettings);
$pageRenderer->addInlineLanguageLabelFile('EXT:form/Resources/Private/Language/locallang_formEditor_failSafeErrorHandling_javascript.xlf');
$stylesheets = $this->resolveResourcePaths($this->prototypeConfiguration['formEditor']['stylesheets']);
foreach ($stylesheets as $stylesheet) {
$pageRenderer->addCssFile($stylesheet);
}
return $this->htmlResponse();
}
......
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<f:be.pageRenderer includeCssFiles="{stylesheets}" addInlineSettings="{addInlineSettings}" includeJsFiles="{0: 'EXT:backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js'}" />
<div data-identifier="moduleLoadingIndicator" class="form-editor-loading-spinner">
<core:icon identifier="spinner-circle-dark" size="default" />
<div class="form-editor-loading-spinner-label"><f:translate key="LLL:EXT:form/Resources/Private/Language/Database.xlf:formEditor.loading" /></div>
......
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