Programmatically adding PHP generated TypoScript to the backend configuration


Today I’ve struggled with adding PHP generated TypoScript configuration to the backend. There doesn’t seem to be an API for this, unfortunately, so I had to dig a little bit into the TYPO3 source.

Turns out that t3lib_befunc#getPagesTSconfig, which is responsible for retrieving TypoScript configuration for the backend, makes use of the following global variable as the “default TypoScript configuration”:

$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig']

So, being short of a proper API, I ended up simply appending my generated configuration to the defaultPageTSconfig string (in my ext_localconf.php file).

Is there a better way to achieve the same thing? If so, let me know :)