<?php .. include:: /Includes.rst.txt

Deprecation: #109329 - PageRenderer get() methods 

See forge#109329

Description 

The following methods have been deprecated:

  • TYPO3\CMS\Core\Page\PageRenderer->getTitle()
  • TYPO3\CMS\Core\Page\PageRenderer->getLanguage()
  • TYPO3\CMS\Core\Page\PageRenderer->getDocType()
  • TYPO3\CMS\Core\Page\PageRenderer->getHtmlTag()
  • TYPO3\CMS\Core\Page\PageRenderer->getHeadTag()
  • TYPO3\CMS\Core\Page\PageRenderer->getFavIcon()
  • TYPO3\CMS\Core\Page\PageRenderer->getIconMimeType()
  • TYPO3\CMS\Core\Page\PageRenderer->getTemplateFile()
  • TYPO3\CMS\Core\Page\PageRenderer->getMoveJsFromHeaderToFooter()
  • TYPO3\CMS\Core\Page\PageRenderer->getBodyContent()
  • TYPO3\CMS\Core\Page\PageRenderer->getInlineLanguageLabels()
  • TYPO3\CMS\Core\Page\PageRenderer->getInlineLanguageLabelFiles()
  • TYPO3\CMS\Core\Page\PageRenderer->getMetaTag()
  • TYPO3\CMS\Core\Page\PageRenderer->removeMetaTag()
  • TYPO3\CMS\Frontend\ContentObject\AbstractContentObject->getPageRenderer()

Impact 

Invoking any of the methods listed above will generate a deprecation-level log entry in TYPO3 v14. These methods are scheduled for removal in TYPO3 v15.

The PageRenderer singleton represents a central yet problematic construct, particularly in TYPO3 frontend rendering, from an architectural perspective. With the deprecation of these methods, the class loses its ability to serve as a data source: data can still be added, but no longer retrieved. This change paves the way for refactoring the construct in TYPO3 v15, including the introduction of a compatibility layer to maintain backward compatibility.

Affected installations 

Instances with extensions invoking one of the above methods are affected. The extension scanner is configured to find consumers except the generic method names getTitle(), getLanguage() and getPageRenderer.

Migration 

In practice, there is often little reason to rely on the methods mentioned above. Most data passed to PageRenderer is handled through mechanisms that can be intercepted and configured, for example title and meta tag handling. As a result, the deprecated get() methods do not have a direct replacement.

A commonly used case is PageRenderer->getDocType(), which determines whether self-closing tags should include a trailing slash (/). This is only relevant in the frontend, as the backend always uses HTML5. The DocType itself is derived from TypoScript configuration, which is a Request attribute.

Example before:

$needsEndingSlash = GeneralUtility::makeInstance(PageRenderer::class)->getDocType()->isXmlCompliant()
Copied!

Example after:

$needsEndingSlash = DocType::createFromRequest($request)->isXmlCompliant()
Copied!