PageInformationFactory
Create the PageInformation object. This is typically fired by a middleware. It does all the heavy lifting, page access checks, resolves shortcuts, workspaces, languages and similar.
Possible results:
- The fully set up PageInformation object is returned.
- A PageInformationCreationFailedException is thrown that contains an early Response from the ErrorController
- A StatusException is thrown when ErrorController itself failed
Tags
Table of Contents
Methods
- __construct() : mixed
- create() : PageInformation
- Set up proper PageInformation object later available as 'frontend.page.information' Request attribute.
- checkBackendUserAccess() : void
- When a backend user is logged in, it needs at least 'show' permissions.
- checkCrossDomainWithDirectId() : void
- When calling a page with a direct id 'https://my.domain/?id=123', this the site object of 'my.domain' is determined from an earlier middleware.
- checkRootlineForIncludeSection() : void
- Checks if visibility of the page is blocked upwards in the root line.
- getBackendUser() : FrontendBackendUserAuthentication|null
- getRootlineOrThrow() : array<string|int, mixed>
- setContentFromPid() : PageInformation
- Check the value of 'content_from_pid' of the current page record, to see if the current request should actually show content from another page.
- setLocalRootLine() : PageInformation
- Calculate "local" rootLine that stops at first root=1 template.
- setPageAndRootline() : PageInformation
- Main lifting. Final page and the matching root line are determined and loaded.
- setPageLayout() : PageInformation
- Resolve the selected backend layout for the current page and add it to the page information
- setSysTemplateRows() : PageInformation
- Determine relevant sys_template rows and set to PageInformation object.
- settingLanguage() : PageInformation
- Determine the final Context language aspect, page record based on language settings, existing page overlay and its rootLine.
Methods
__construct()
public
__construct(Context $context, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger, RecordAccessVoter $accessVoter, ErrorController $errorController, SysTemplateRepository $sysTemplateRepository, PageLayoutResolver $pageLayoutResolver) : mixed
Parameters
- $context : Context
- $eventDispatcher : EventDispatcherInterface
- $logger : LoggerInterface
- $accessVoter : RecordAccessVoter
- $errorController : ErrorController
- $sysTemplateRepository : SysTemplateRepository
- $pageLayoutResolver : PageLayoutResolver
create()
Set up proper PageInformation object later available as 'frontend.page.information' Request attribute.
public
create(ServerRequestInterface $request) : PageInformation
At this point, the Context object already contains relevant preview settings, for instance if a backend user is logged in.
As a not obvious side effect, this class also sets the
Parameters
- $request : ServerRequestInterface
Extensions should not call themselves, use events.
Tags
Return values
PageInformationcheckBackendUserAccess()
When a backend user is logged in, it needs at least 'show' permissions.
protected
checkBackendUserAccess(ServerRequestInterface $request, PageInformation $pageInformation) : void
Parameters
- $request : ServerRequestInterface
- $pageInformation : PageInformation
Tags
checkCrossDomainWithDirectId()
When calling a page with a direct id 'https://my.domain/?id=123', this the site object of 'my.domain' is determined from an earlier middleware.
protected
checkCrossDomainWithDirectId(ServerRequestInterface $request, PageInformation $pageInformation) : void
If now '123' is not a (sub) page of the 'my.domain' site, we error out since we don't want to directly render content of a different site page within "our" site. Except if '123' is a shortcut, we still allow it, since that will trigger a redirect to the url with the shortcut target domain later.
Parameters
- $request : ServerRequestInterface
- $pageInformation : PageInformation
Tags
checkRootlineForIncludeSection()
Checks if visibility of the page is blocked upwards in the root line.
protected
checkRootlineForIncludeSection(ServerRequestInterface $request, PageInformation $pageInformation) : void
The blocking feature of a page must be turned on by setting the page record field 'extendToSubpages' to 1 for 'hidden', 'starttime', 'endtime' 'fe_group' restrictions to bubble down in rootLine.
Additionally, this method checks for backend user sections in root line and if found, evaluates if a backend user is logged in and has access.
Parameters
- $request : ServerRequestInterface
- $pageInformation : PageInformation
Tags
getBackendUser()
protected
getBackendUser() : FrontendBackendUserAuthentication|null
Return values
FrontendBackendUserAuthentication|nullgetRootlineOrThrow()
protected
getRootlineOrThrow(ServerRequestInterface $request, int $pageId, string $mountPoint) : array<string|int, mixed>
Parameters
- $request : ServerRequestInterface
- $pageId : int
- $mountPoint : string
Tags
Return values
array<string|int, mixed>setContentFromPid()
Check the value of 'content_from_pid' of the current page record, to see if the current request should actually show content from another page.
protected
setContentFromPid(ServerRequestInterface $request, PageInformation $pageInformation) : PageInformation
If so, PageInformation->getContentFromPid() is set to the page id of the content page, while PageInformation->getId() is kept as the original page id. If there is no 'content_from_pid', PageInformation->getId() and PageInformation->getContentFromPid() end up carrying the same page ids.
Parameters
- $request : ServerRequestInterface
- $pageInformation : PageInformation
Tags
Return values
PageInformationsetLocalRootLine()
Calculate "local" rootLine that stops at first root=1 template.
protected
setLocalRootLine(ServerRequestInterface $request, PageInformation $pageInformation) : PageInformation
Parameters
- $request : ServerRequestInterface
- $pageInformation : PageInformation
Return values
PageInformationsetPageAndRootline()
Main lifting. Final page and the matching root line are determined and loaded.
protected
setPageAndRootline(ServerRequestInterface $request, PageInformation $pageInformation) : PageInformation
Note this methods may be called a second time in case of 'content_from_pid'.
Parameters
- $request : ServerRequestInterface
- $pageInformation : PageInformation
Tags
Return values
PageInformationsetPageLayout()
Resolve the selected backend layout for the current page and add it to the page information
protected
setPageLayout(PageInformation $pageInformation) : PageInformation
Parameters
- $pageInformation : PageInformation
Return values
PageInformationsetSysTemplateRows()
Determine relevant sys_template rows and set to PageInformation object.
protected
setSysTemplateRows(ServerRequestInterface $request, PageInformation $pageInformation) : PageInformation
Parameters
- $request : ServerRequestInterface
- $pageInformation : PageInformation
Tags
Return values
PageInformationsettingLanguage()
Determine the final Context language aspect, page record based on language settings, existing page overlay and its rootLine.
protected
settingLanguage(ServerRequestInterface $request, PageInformation $pageInformation) : PageInformation
May reset: $pageInformation->pageRecord $pageInformation->pageRepository $pageInformation->rootLine
Parameters
- $request : ServerRequestInterface
- $pageInformation : PageInformation