Deprecation: #100033 - TBE_STYLES stylesheet and stylesheet2

See forge#100033

Description

The usage of $GLOBALS['TBE_STYLES']['stylesheet'] and $GLOBALS['TBE_STYLES']['stylesheet2'] to add custom CSS files to the TYPO3 backend has been marked as deprecated in TYPO3 v12 and will be removed in TYPO3 v13.

Impact

Using any of the following configuration declarations

  • $GLOBALS['TBE_STYLES']['stylesheet']
  • $GLOBALS['TBE_STYLES']['stylesheet2']

will trigger a PHP deprecation notice and will throw a fatal PHP error in TYPO3 v13.

Affected installations

The extension scanner will find extensions using

  • $GLOBALS['TBE_STYLES']['stylesheet']
  • $GLOBALS['TBE_STYLES']['stylesheet2']

as "weak" matches.

Migration

Extensions should use $GLOBALS['TYPO3_CONF_VARS']['BE']['stylesheets']['my_extension'] where 'my_extension' is the extension key.

Example

EXT:my_extension/ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['BE']['stylesheets']['my_extension'] = 'EXT:my_extension/Resources/Public/Css';
Copied!

In the example above, all CSS files in the configured directory will be loaded in TYPO3 backend.