Bug #77534
closedMultiple Inline-CSS overrides each other
100%
Description
Hi there,
Using latest 7.6.10.
When you are on a page where some 'Default CSS' & 'Specific Page CSS' gets included and you set in your config:
removePageCss = 0 removeDefaultCss = 0 inlineStyle2TempFile = 0
The 'Default CSS' (from extensions) gets overridden by the 'Specific Page CSS'.
This only happens when inlineStyle2TempFile = 0
(CSS gets included inline and not in a external file).
You can test it by setting removePageCss = 1
. Then the PageCSS gets removed but the DefaultCSS appears as expected.
The problem:
/frontend/Classes/Page/PageGenerator.php at 1217
addCssToPageRenderer() has the parameter $inlineBlockName = 'TSFEinlineStyle'
at 1220: Parameter gets passed.
self::getPageRenderer()->addCssInlineBlock($inlineBlockName,...)
PageRenderer.php at 1503 the array key gets overridden.
public function addCssInlineBlock($name, $block, $compress = false, $forceOnTop = false) { if (!isset($this->cssInline[$name]) && !empty($block)) { $this->cssInline[$name] = array( 'code' => $block, 'compress' => $compress, 'forceOnTop' => $forceOnTop ); } }
The temp solution for me:
Set a different inlineBlockName
for the PageCSS and the DefaultCSS.
/frontend/Classes/Page/PageGenerator.php at 432self::addCssToPageRenderer($cssPageStyle, true);
to self::addCssToPageRenderer($cssPageStyle, true, 'InlinePageCss');
/frontend/Classes/Page/PageGenerator.php at 437self::addCssToPageRenderer($stylesFromPlugins);
to self::addCssToPageRenderer($stylesFromPlugins, false, 'InlineDefaultCss');
Best regards
Nicolas