Deprecation: #90421 - DocumentTemplate
See forge#90421
Description
The PHP class
\TYPO3\,
also available as
$GLOBALS until TYPO3 v10.0
served as a basis to render backend modules or HTML-based output
in TYPO3 Backend.
Since TYPO3 v7, the new API via php:Module can be used instead. The
Document class has been marked as deprecated.
Impact
Instantiating the
Document class will trigger a PHP
E_ error.
Affected Installations
TYPO3 installations with third-party extensions adding backend modules using the DocumentTemplate API. These can typically be identified by extensions that "worked" but somehow looked ugly since TYPO3 v7 due to CSS and HTML changes.
Migration
Use ModuleTemplate API instead, which can be built like this in a typical non-Extbase Backend controller (e.g. in an action such as "overviewAction"):
$moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
$content = $this->getHtmlContentFromMyModule();
$moduleTemplate->setTitle('My module');
$moduleTemplate->setContent($content);
return $this->responseFactory->createResponse()
->withHeader('Content-Type', 'text/html; charset=utf-8')
->withBody($this->streamFactory->createStream($moduleTemplate->renderContent()));