From 1b5ece88e7eeb4f07580e2a9aa9688c5fbb1b32c Mon Sep 17 00:00:00 2001
From: Benjamin Franzke <ben@bnf.dev>
Date: Wed, 6 Mar 2024 10:59:50 +0100
Subject: [PATCH] [BUGFIX] Fix FormEngine inline stylesheet resolution in
 composer mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The public URL resolution in lazy loaded TCA forms (e.g. inline records)
is aligned to use the same path resolution mechanism as in PageRender.

Releases: main, 12.4, 11.5
Resolves: #103296
Change-Id: I981af29b34393302c49dd16216f0baa580d60767
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83230
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: Benjamin Franzke <ben@bnf.dev>
---
 .../Classes/Controller/AbstractFormEngineAjaxController.php   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/backend/Classes/Controller/AbstractFormEngineAjaxController.php b/typo3/sysext/backend/Classes/Controller/AbstractFormEngineAjaxController.php
index e44810100e3d..d15e4d600a8e 100644
--- a/typo3/sysext/backend/Classes/Controller/AbstractFormEngineAjaxController.php
+++ b/typo3/sysext/backend/Classes/Controller/AbstractFormEngineAjaxController.php
@@ -17,6 +17,7 @@ declare(strict_types=1);
 
 namespace TYPO3\CMS\Backend\Controller;
 
+use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
 use TYPO3\CMS\Core\Page\JavaScriptItems;
@@ -59,7 +60,8 @@ abstract class AbstractFormEngineAjaxController
     protected function getRelativePathToStylesheetFile(string $stylesheetFile): string
     {
         if (PathUtility::isExtensionPath($stylesheetFile)) {
-            $stylesheetFile = GeneralUtility::getFileAbsFileName($stylesheetFile);
+            // @see PageRenderer::getStreamlinedFileName()
+            $stylesheetFile = Environment::getPublicPath() . '/' . PathUtility::getPublicResourceWebPath($stylesheetFile, false);
             $stylesheetFile = PathUtility::getRelativePathTo($stylesheetFile) ?? '';
             $stylesheetFile = rtrim($stylesheetFile, '/');
         } else {
-- 
GitLab