Deprecation: #109329 - PageRenderer get() methods
See forge#109329
Description
The following methods have been deprecated:
TYPO3\CMS\ Core\ Page\ Page Renderer->get Title () TYPO3\CMS\ Core\ Page\ Page Renderer->get Language () TYPO3\CMS\ Core\ Page\ Page Renderer->get Doc Type () TYPO3\CMS\ Core\ Page\ Page Renderer->get Html Tag () TYPO3\CMS\ Core\ Page\ Page Renderer->get Head Tag () TYPO3\CMS\ Core\ Page\ Page Renderer->get Fav Icon () TYPO3\CMS\ Core\ Page\ Page Renderer->get Icon Mime Type () TYPO3\CMS\ Core\ Page\ Page Renderer->get Template File () TYPO3\CMS\ Core\ Page\ Page Renderer->get Move Js From Header To Footer () TYPO3\CMS\ Core\ Page\ Page Renderer->get Body Content () TYPO3\CMS\ Core\ Page\ Page Renderer->get Inline Language Labels () TYPO3\CMS\ Core\ Page\ Page Renderer->get Inline Language Label Files () TYPO3\CMS\ Core\ Page\ Page Renderer->get Meta Tag () TYPO3\CMS\ Core\ Page\ Page Renderer->remove Meta Tag () TYPO3\CMS\ Frontend\ Content Object\ Abstract Content Object->get Page Renderer ()
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.
From an architectural perspective, the
Page singleton represents
a central yet problematic construct, particularly in TYPO3 frontend
rendering. With the deprecation of
these methods, the
Page 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 methods listed above are
affected. The extension scanner is configured to find consumers, apart from the
generic method names
get,
get, and
get.
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
Page, which
determines whether self-closing tags should include a trailing slash
(/). This is relevant only in the frontend, as the backend
always uses HTML5. The DocType itself is derived from TypoScript
configuration, which is available as a request attribute.
Before:
$needsEndingSlash = GeneralUtility::makeInstance(PageRenderer::class)
->getDocType()
->isXmlCompliant();
After:
$needsEndingSlash = DocType::createFromRequest($request)
->isXmlCompliant();