typo3/sysext/core/Classes/Page/PageRenderer.php | 28 +++++++++++++++------- .../sysext/frontend/Classes/Page/PageGenerator.php | 3 ++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php index a2ffbbf..5ff4343 100644 --- a/typo3/sysext/core/Classes/Page/PageRenderer.php +++ b/typo3/sysext/core/Classes/Page/PageRenderer.php @@ -1354,8 +1354,9 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface * @param string $allWrap * @param bool $excludeFromConcatenation * @param string $splitChar The char used to split the allWrap value, default is "|" + * @param bool $forceInline */ - public function addCssFile($file, $rel = 'stylesheet', $media = 'all', $title = '', $compress = true, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|') + public function addCssFile($file, $rel = 'stylesheet', $media = 'all', $title = '', $compress = true, $forceOnTop = false, $allWrap = '', $excludeFromConcatenation = false, $splitChar = '|', $forceInline = false) { if (!isset($this->cssFiles[$file])) { $this->cssFiles[$file] = [ @@ -1367,7 +1368,8 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface 'forceOnTop' => $forceOnTop, 'allWrap' => $allWrap, 'excludeFromConcatenation' => $excludeFromConcatenation, - 'splitChar' => $splitChar + 'splitChar' => $splitChar, + 'forceInline' => $forceInline ]; } } @@ -2208,12 +2210,22 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface $cssFiles = ''; if (!empty($this->cssFiles)) { foreach ($this->cssFiles as $file => $properties) { - $file = $this->getStreamlinedFileName($file); - $tag = 'endingSlash . '>'; + $href = $this->getStreamlinedFileName($file); + if ($properties['forceInline'] && @is_file($file)) { + $cssInline = file_get_contents($file); + $tag = ''; + } else { + $tag = 'endingSlash . '>'; + } if ($properties['allWrap']) { $wrapArr = explode($properties['splitChar'] ?: '|', $properties['allWrap'], 2); $tag = $wrapArr[0] . $tag . $wrapArr[1]; diff --git a/typo3/sysext/frontend/Classes/Page/PageGenerator.php b/typo3/sysext/frontend/Classes/Page/PageGenerator.php index 5ca0187..ef1034f 100644 --- a/typo3/sysext/frontend/Classes/Page/PageGenerator.php +++ b/typo3/sysext/frontend/Classes/Page/PageGenerator.php @@ -304,7 +304,8 @@ class PageGenerator (bool)$cssFileConfig['forceOnTop'], $cssFileConfig['allWrap'], (bool)$cssFileConfig['excludeFromConcatenation'], - $cssFileConfig['allWrap.']['splitChar'] + $cssFileConfig['allWrap.']['splitChar'], + $cssFileConfig['forceInline'] ); unset($cssFileConfig); }