Project

General

Profile

Actions

Bug #77534

closed

Multiple Inline-CSS overrides each other

Added by Nicolas Scheidler over 8 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Frontend
Target version:
Start date:
2016-11-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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 432
self::addCssToPageRenderer($cssPageStyle, true); to self::addCssToPageRenderer($cssPageStyle, true, 'InlinePageCss');

/frontend/Classes/Page/PageGenerator.php at 437
self::addCssToPageRenderer($stylesFromPlugins); to self::addCssToPageRenderer($stylesFromPlugins, false, 'InlineDefaultCss');

Best regards
Nicolas

Actions

Also available in: Atom PDF