From f43979e74409500b731a98b39f978379669ed2e9 Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Sun, 28 Nov 2021 13:34:24 +0100
Subject: [PATCH] [!!!][TASK] Remove TypoScript option
 page.includeCSS/includeCSSLibs.import
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The option to use the @import syntax in TypoScript
"page.includeCSS" and "page.includeCSSLibs"
(.import subproperty per CSS file) will not work anymore.

Resolves: #96118
Related: #95349
Releases: master
Change-Id: Ibcbcf091eca00d061cc79b551f87995ddf47c1a0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72338
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 ...g-96107-DeprecatedFunctionalityRemoved.rst |  5 +-
 .../frontend/Classes/Http/RequestHandler.php  | 74 +++++++------------
 2 files changed, 29 insertions(+), 50 deletions(-)

diff --git a/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst
index 00ef35647a0a..411555b9dee2 100644
--- a/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst
+++ b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst
@@ -73,9 +73,10 @@ The following ViewHelpers have been changed or removed:
 - :html:`<be:moduleLayout.button.linkButton>` removed
 - :html:`<be:moduleLayout.button.shortcutButton>` removed
 
-The following TypoScript options have been dropped or adapted:
+The following TypoScript options have been removed or adapted:
 
-- `typo.script.option`
+- `page.includeCSS.myfile*.import`
+- `page.includeCSSLibs.myfile*.import`
 
 The following constants have been dropped:
 
diff --git a/typo3/sysext/frontend/Classes/Http/RequestHandler.php b/typo3/sysext/frontend/Classes/Http/RequestHandler.php
index 7b6ecbd21983..cd59c76d0a71 100644
--- a/typo3/sysext/frontend/Classes/Http/RequestHandler.php
+++ b/typo3/sysext/frontend/Classes/Http/RequestHandler.php
@@ -443,31 +443,20 @@ class RequestHandler implements RequestHandlerInterface
                         }
                     }
                     if ($ss) {
-                        if ($cssFileConfig['import'] ?? false) {
-                            // @deprecated will be removed in TYPO3 v12.0.
-                            if (!($cssFileConfig['external'] ?? false) && $ss[0] !== '/') {
-                                // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
-                                $ss = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
-                            }
-                            trigger_error('Using @import via "page.includeCSS.my-identifier.import = 1" within TypoScript will be removed in TYPO3 v12.0.', E_USER_DEPRECATED);
-                            $cssMedia = !empty($cssFileConfig['media']) ? ' ' . htmlspecialchars($cssFileConfig['media']) : '';
-                            $pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '")' . $cssMedia . ';', empty($cssFileConfig['disableCompression']), (bool)($cssFileConfig['forceOnTop'] ?? false));
-                        } else {
-                            $pageRenderer->addCssFile(
-                                $ss,
-                                ($cssFileConfig['alternate'] ?? false) ? 'alternate stylesheet' : 'stylesheet',
-                                ($cssFileConfig['media'] ?? false) ?: 'all',
-                                ($cssFileConfig['title'] ?? false) ?: '',
-                                empty($cssFileConfig['external']) && empty($cssFileConfig['inline']) && empty($cssFileConfig['disableCompression']),
-                                (bool)($cssFileConfig['forceOnTop'] ?? false),
-                                $cssFileConfig['allWrap'] ?? '',
-                                ($cssFileConfig['excludeFromConcatenation'] ?? false) || ($cssFileConfig['inline'] ?? false),
-                                $cssFileConfig['allWrap.']['splitChar'] ?? '|',
-                                (bool)($cssFileConfig['inline'] ?? false)
-                            );
-                            unset($cssFileConfig);
-                        }
+                        $pageRenderer->addCssFile(
+                            $ss,
+                            ($cssFileConfig['alternate'] ?? false) ? 'alternate stylesheet' : 'stylesheet',
+                            ($cssFileConfig['media'] ?? false) ?: 'all',
+                            ($cssFileConfig['title'] ?? false) ?: '',
+                            empty($cssFileConfig['external']) && empty($cssFileConfig['inline']) && empty($cssFileConfig['disableCompression']),
+                            (bool)($cssFileConfig['forceOnTop'] ?? false),
+                            $cssFileConfig['allWrap'] ?? '',
+                            ($cssFileConfig['excludeFromConcatenation'] ?? false) || ($cssFileConfig['inline'] ?? false),
+                            $cssFileConfig['allWrap.']['splitChar'] ?? '|',
+                            (bool)($cssFileConfig['inline'] ?? false)
+                        );
                     }
+                    unset($cssFileConfig);
                 }
             }
         }
@@ -488,31 +477,20 @@ class RequestHandler implements RequestHandlerInterface
                         }
                     }
                     if ($ss) {
-                        if ($cssFileConfig['import'] ?? false) {
-                            // @deprecated will be removed in TYPO3 v12.0.
-                            if (!($cssFileConfig['external'] ?? false) && $ss[0] !== '/') {
-                                // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
-                                $ss = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
-                            }
-                            trigger_error('Using @import via "page.includeCSSLibs.my-identifier.import = 1" within TypoScript will be removed in TYPO3 v12.0.', E_USER_DEPRECATED);
-                            $cssMedia = !empty($cssFileConfig['media']) ? ' ' . htmlspecialchars($cssFileConfig['media']) : '';
-                            $pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '")' . $cssMedia . ';', empty($cssFileConfig['disableCompression']), (bool)($cssFileConfig['forceOnTop'] ?? false));
-                        } else {
-                            $pageRenderer->addCssLibrary(
-                                $ss,
-                                ($cssFileConfig['alternate'] ?? false) ? 'alternate stylesheet' : 'stylesheet',
-                                ($cssFileConfig['media'] ?? false) ?: 'all',
-                                ($cssFileConfig['title'] ?? false) ?: '',
-                                empty($cssFileConfig['external']) && empty($cssFileConfig['inline']) && empty($cssFileConfig['disableCompression']),
-                                (bool)($cssFileConfig['forceOnTop'] ?? false),
-                                $cssFileConfig['allWrap'] ?? '',
-                                ($cssFileConfig['excludeFromConcatenation'] ?? false) || ($cssFileConfig['inline'] ?? false),
-                                $cssFileConfig['allWrap.']['splitChar'] ?? '|',
-                                (bool)($cssFileConfig['inline'] ?? false)
-                            );
-                            unset($cssFileConfig);
-                        }
+                        $pageRenderer->addCssLibrary(
+                            $ss,
+                            ($cssFileConfig['alternate'] ?? false) ? 'alternate stylesheet' : 'stylesheet',
+                            ($cssFileConfig['media'] ?? false) ?: 'all',
+                            ($cssFileConfig['title'] ?? false) ?: '',
+                            empty($cssFileConfig['external']) && empty($cssFileConfig['inline']) && empty($cssFileConfig['disableCompression']),
+                            (bool)($cssFileConfig['forceOnTop'] ?? false),
+                            $cssFileConfig['allWrap'] ?? '',
+                            ($cssFileConfig['excludeFromConcatenation'] ?? false) || ($cssFileConfig['inline'] ?? false),
+                            $cssFileConfig['allWrap.']['splitChar'] ?? '|',
+                            (bool)($cssFileConfig['inline'] ?? false)
+                        );
                     }
+                    unset($cssFileConfig);
                 }
             }
         }
-- 
GitLab