‪TYPO3CMS  ‪main
TYPO3\CMS\Frontend\Page\PageInformationFactory Class Reference

Public Member Functions

 __construct (private Context $context, private EventDispatcherInterface $eventDispatcher, private LoggerInterface $logger, private RecordAccessVoter $accessVoter, private ErrorController $errorController, private SysTemplateRepository $sysTemplateRepository,)
 
 create (ServerRequestInterface $request)
 

Protected Member Functions

 setPageAndRootline (ServerRequestInterface $request, PageInformation $pageInformation)
 
 settingLanguage (ServerRequestInterface $request, PageInformation $pageInformation)
 
 setContentFromPid (ServerRequestInterface $request, PageInformation $pageInformation)
 
 checkRootlineForIncludeSection (ServerRequestInterface $request, PageInformation $pageInformation)
 
 checkCrossDomainWithDirectId (ServerRequestInterface $request, PageInformation $pageInformation)
 
 checkBackendUserAccess (ServerRequestInterface $request, PageInformation $pageInformation)
 
 setSysTemplateRows (ServerRequestInterface $request, PageInformation $pageInformation)
 
 setLocalRootLine (ServerRequestInterface $request, PageInformation $pageInformation)
 
non empty array getRootlineOrThrow (ServerRequestInterface $request, int $pageId, string $mountPoint)
 
 getBackendUser ()
 

Detailed Description

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

    Todo:
    ‪: This class also sets / resets the Context language aspect as not directly obvious side effect. This can't be refactored currently due to the dependency of stateful PageRepository to the stateful singleton Context.

Definition at line 62 of file PageInformationFactory.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\Page\PageInformationFactory::__construct ( private Context  $context,
private EventDispatcherInterface  $eventDispatcher,
private LoggerInterface  $logger,
private RecordAccessVoter  $accessVoter,
private ErrorController  $errorController,
private SysTemplateRepository  $sysTemplateRepository 
)

Definition at line 64 of file PageInformationFactory.php.

Member Function Documentation

◆ checkBackendUserAccess()

TYPO3\CMS\Frontend\Page\PageInformationFactory::checkBackendUserAccess ( ServerRequestInterface  $request,
PageInformation  $pageInformation 
)
protected

◆ checkCrossDomainWithDirectId()

TYPO3\CMS\Frontend\Page\PageInformationFactory::checkCrossDomainWithDirectId ( ServerRequestInterface  $request,
PageInformation  $pageInformation 
)
protected

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. 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.

Exceptions
PageInformationCreationFailedException
StatusException

Definition at line 478 of file PageInformationFactory.php.

References TYPO3\CMS\Frontend\Page\PageAccessFailureReasons\ACCESS_DENIED_HOST_PAGE_MISMATCH, TYPO3\CMS\Frontend\Page\PageInformation\getOriginalShortcutPageRecord(), and TYPO3\CMS\Frontend\Page\PageInformation\getRootLine().

Referenced by TYPO3\CMS\Frontend\Page\PageInformationFactory\create().

◆ checkRootlineForIncludeSection()

TYPO3\CMS\Frontend\Page\PageInformationFactory::checkRootlineForIncludeSection ( ServerRequestInterface  $request,
PageInformation  $pageInformation 
)
protected

Checks if visibility of the page is blocked upwards in the root line.

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.

Exceptions
PageInformationCreationFailedException
StatusException

Definition at line 425 of file PageInformationFactory.php.

References TYPO3\CMS\Frontend\Page\PageAccessFailureReasons\ACCESS_DENIED_SUBSECTION_NOT_RESOLVED, TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_BE_USER_SECTION, TYPO3\CMS\Frontend\Page\PageInformationFactory\getBackendUser(), TYPO3\CMS\Frontend\Page\PageInformation\getPageRecord(), TYPO3\CMS\Frontend\Page\PageInformation\getRootLine(), and TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW.

Referenced by TYPO3\CMS\Frontend\Page\PageInformationFactory\setPageAndRootline().

◆ create()

TYPO3\CMS\Frontend\Page\PageInformationFactory::create ( ServerRequestInterface  $request)

Set up proper PageInformation object later available as 'frontend.page.information' Request attribute.

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

Extensions should not call themselves, use events.

Exceptions
PageInformationCreationFailedException
StatusException

Definition at line 86 of file PageInformationFactory.php.

References $GLOBALS, TYPO3\CMS\Frontend\Page\PageInformationFactory\checkBackendUserAccess(), TYPO3\CMS\Frontend\Page\PageInformationFactory\checkCrossDomainWithDirectId(), TYPO3\CMS\Frontend\Page\PageInformationFactory\setContentFromPid(), TYPO3\CMS\Frontend\Page\PageInformationFactory\setLocalRootLine(), TYPO3\CMS\Frontend\Page\PageInformationFactory\setPageAndRootline(), TYPO3\CMS\Frontend\Page\PageInformationFactory\setSysTemplateRows(), and TYPO3\CMS\Frontend\Page\PageInformationFactory\settingLanguage().

◆ getBackendUser()

TYPO3\CMS\Frontend\Page\PageInformationFactory::getBackendUser ( )
protected

◆ getRootlineOrThrow()

non empty array TYPO3\CMS\Frontend\Page\PageInformationFactory::getRootlineOrThrow ( ServerRequestInterface  $request,
int  $pageId,
string  $mountPoint 
)
protected

◆ setContentFromPid()

TYPO3\CMS\Frontend\Page\PageInformationFactory::setContentFromPid ( ServerRequestInterface  $request,
PageInformation  $pageInformation 
)
protected

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. 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.

Exceptions
PageInformationCreationFailedException
StatusException

Definition at line 395 of file PageInformationFactory.php.

References TYPO3\CMS\Frontend\Page\PageInformation\getId(), TYPO3\CMS\Frontend\Page\PageInformation\getPageRecord(), TYPO3\CMS\Frontend\Page\PageInformation\setContentFromPid(), and TYPO3\CMS\Frontend\Page\PageInformationFactory\setPageAndRootline().

Referenced by TYPO3\CMS\Frontend\Page\PageInformationFactory\create().

◆ setLocalRootLine()

TYPO3\CMS\Frontend\Page\PageInformationFactory::setLocalRootLine ( ServerRequestInterface  $request,
PageInformation  $pageInformation 
)
protected

◆ setPageAndRootline()

TYPO3\CMS\Frontend\Page\PageInformationFactory::setPageAndRootline ( ServerRequestInterface  $request,
PageInformation  $pageInformation 
)
protected

Main lifting. Final page and the matching root line are determined and loaded.

Note this methods may be called a second time in case of 'content_from_pid'.

Exceptions
PageInformationCreationFailedException
StatusException

Definition at line 131 of file PageInformationFactory.php.

References $GLOBALS, TYPO3\CMS\Frontend\Page\PageAccessFailureReasons\ACCESS_DENIED_INVALID_PAGETYPE, TYPO3\CMS\Frontend\Page\PageAccessFailureReasons\ACCESS_DENIED_PAGE_NOT_RESOLVED, TYPO3\CMS\Frontend\Page\PageInformationFactory\checkRootlineForIncludeSection(), TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_MOUNTPOINT, TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_SHORTCUT, TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_SPACER, TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_SYSFOLDER, TYPO3\CMS\Frontend\Page\PageInformation\getId(), TYPO3\CMS\Frontend\Page\PageInformation\getMountPoint(), TYPO3\CMS\Frontend\Page\PageInformation\getOriginalShortcutPageRecord(), TYPO3\CMS\Frontend\Page\PageInformation\getPageRecord(), TYPO3\CMS\Frontend\Page\PageInformationFactory\getRootlineOrThrow(), TYPO3\CMS\Frontend\Page\PageAccessFailureReasons\PAGE_NOT_FOUND, TYPO3\CMS\Frontend\Page\PageInformation\setId(), TYPO3\CMS\Frontend\Page\PageInformation\setMountPoint(), TYPO3\CMS\Frontend\Page\PageInformation\setOriginalMountPointPageRecord(), TYPO3\CMS\Frontend\Page\PageInformation\setOriginalShortcutPageRecord(), TYPO3\CMS\Frontend\Page\PageInformation\setPageRecord(), TYPO3\CMS\Frontend\Page\PageInformation\setRootLine(), and TYPO3\CMS\Frontend\Page\PageInformationFactory\settingLanguage().

Referenced by TYPO3\CMS\Frontend\Page\PageInformationFactory\create(), and TYPO3\CMS\Frontend\Page\PageInformationFactory\setContentFromPid().

◆ setSysTemplateRows()

TYPO3\CMS\Frontend\Page\PageInformationFactory::setSysTemplateRows ( ServerRequestInterface  $request,
PageInformation  $pageInformation 
)
protected

Determine relevant sys_template rows and set to PageInformation object.

Todo:
‪: Even though all rootline sys_template records are fetched with only one query in below implementation, we could potentially join or sub select sys_template records already when pages rootline is queried. This will save one query. This could be done when we manage to switch PageRepository / RootlineUtility to a CTE.
Exceptions
PageInformationCreationFailedException
StatusException

Definition at line 534 of file PageInformationFactory.php.

References TYPO3\CMS\Frontend\Page\PageInformation\getRootLine(), TYPO3\CMS\Core\Site\Entity\Site\isTypoScriptRoot(), and TYPO3\CMS\Frontend\Page\PageInformation\setSysTemplateRows().

Referenced by TYPO3\CMS\Frontend\Page\PageInformationFactory\create().

◆ settingLanguage()