Feature: #108866 - Page record object in frontend page information
See forge#108866
Description
The frontend request attribute
frontend., an instance
of
\TYPO3\, provides the new method
get. It returns the current page as record object implementing
\TYPO3\, created by the Record API from
the same page row
get returns. The row is the final one of
the request: it reflects resolved shortcuts and mount points, and on a
translated page it is the language overlay. As with
get,
get returns the uid of the page in the default language, the uid
of the translation is available via
get.
Like other resolved records, its fields are transformed according to their TCA
configuration, for example relations such as
media
are resolved to file
references. Only the fields of the page type are available, system fields such
as
crdate
or
starttime
are not. Use
get or
{page. for those. The record is created once the
page and language are resolved, after the event
\TYPO3\.
Relations are resolved lazily on first access.
$page = $request->getAttribute('frontend.page.information')->getRecord();
$title = $page->get('title');
In Fluid templates rendered by
PAGEVIEW
, the record is
available via the
page
variable:
<h1>{page.record.title}</h1>
<f:for each="{page.record.media}" as="image">
<f:image image="{image}" />
</f:for>
get continues to return the page row as array.
Impact
Extensions and templates can access the current frontend page as record object with resolved relations, without creating it from the page row themselves.