Frontend page information 

Changed in version 14.0

This request attribute replaces various page related properties of removed TyposcriptFrontendController .

The frontend.page.information frontend request attribute provides frequently used page information. The attribute is attached to the PSR-7 frontend request by the middleware PrepareTypoScriptFrontendRendering , middlewares below can rely on existence of that attribute.

EXT:my_extension/Classes/Middleware/MyMiddleware.php (excerpt)
/** @var \TYPO3\CMS\Frontend\Page\PageInformation $pageInformation */
$pageInformation = $request->getAttribute('frontend.page.information');

// Formerly $tsfe->id
$id = $pageInformation->getId();

// Formerly $tsfe->page
$page = $pageInformation->getPageRecord();

// Formerly $tsfe->rootLine
$rootLine = $pageInformation->getRootLine();

// Formerly $tsfe->config['rootLine']
$rootLine = $pageInformation->getLocalRootLine();
Copied!

API 

final class PageInformation
Fully qualified name
\TYPO3\CMS\Frontend\Page\PageInformation

This DTO carries various Frontend rendering related page information. It is set up by a Frontend middleware and attached to as 'frontend.page.information' Request attribute.

getId()
Returns
int
getPageRecord()
Returns
array
getRecord()

The page record as resolved record object, created from getPageRecord().

Returns
\TYPO3\CMS\Core\Domain\RecordInterface
getRootLine()
Returns
array
getLocalRootLine()
Returns
array
getPageLayout()
Returns
?\TYPO3\CMS\Core\Page\PageLayout