Stefan Franke
Stefan Franke

Reputation: 106

Adding own CSS to TYPO3 backend [v9]

I am trying to add some CSS styles to the TYPO3 backend (v9). I've added the stylesheet and the following line to the ext_tables.php of my own extension (as described in the file typo3/sysext/backend/Classes/Template/DocumentTemplate.php).

$GLOBALS['TBE_STYLES']['skins'][$_EXTKEY]['stylesheetDirectories'] = ['EXT:my_extension/styles.css'];

When I check the configuration, the new entry show up, so that looks fine. But I don't see any style changes to the backend.

Any ideas anyone? Thanks!

Upvotes: 3

Views: 4109

Answers (1)

Rudy Gnodde
Rudy Gnodde

Reputation: 4575

As the key value (stylesheetDirectories) indicates, this should point to a directory. It will add all .css files in that directory.

Also, don't set $GLOBALS['TBE_STYLES']['skins'][$_EXTKEY]['stylesheetDirectories'] as a new array, but use $GLOBALS['TBE_STYLES']['skins'][$_EXTKEY]['stylesheetDirectories'][] = 'EXT:my_extension/styles/';. That way other extensions can also add stylesheets without it being overwritten by your extension.

Upvotes: 6

Related Questions