‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Routing\PageRouter Class Reference
Inheritance diagram for TYPO3\CMS\Core\Routing\PageRouter:

Public Member Functions

 __construct (Site $site, Context $context=null)
RouteResultInterface PageArguments matchRequest (ServerRequestInterface $request, RouteResultInterface $previousResult=null)
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Routing\RouterInterface
 generateUri ($route, array $parameters=[], string $fragment='', string $type=self::ABSOLUTE_URL)

Protected Member Functions

 resolveMountPointParameterIntoPageSlug (int $pageId, string $pagePath, array $mountPointPairs, PageRepository $pageRepository)
EnhancerInterface[] getEnhancersForPage (int $pageId, SiteLanguage $language)
 generateCacheHash (int $pageId, PageArguments $arguments)
 getCacheHashParameters (int $pageId, PageArguments $arguments)
 buildPageArguments (Route $route, array $results, array $remainingQueryParameters=[])
 resolveType (Route $route, array &$remainingQueryParameters)
 assertMaximumStaticMappableAmount (Route $route, array $variableNames=[])
 filterProcessedParameters (Route $route, $results)
 getSlugCandidateProvider (Context $context)
 isRouteReallyValidForLanguage (Route $route, SiteLanguage $siteLanguage)

Protected Attributes

Site $site
EnhancerFactory $enhancerFactory
AspectFactory $aspectFactory
CacheHashCalculator $cacheHashCalculator
Context $context
RequestContextFactory $requestContextFactory

Additional Inherited Members

- ‪Public Attributes inherited from ‪TYPO3\CMS\Core\Routing\RouterInterface
const ABSOLUTE_URL = 'url'
const ABSOLUTE_PATH = 'absolute'

Detailed Description

Page Router - responsible for a page based on a request, by looking up the slug of the page path. Is also used for generating URLs for pages.

Resolving is done via the "Route Candidate" pattern.


  • ‪/about-us/team/management/

will look for all pages that have

  • ‪/about-us
  • ‪/about-us/
  • ‪/about-us/team
  • ‪/about-us/team/
  • ‪/about-us/team/management
  • ‪/about-us/team/management/

And create route candidates for that.

Please note: PageRouter does not restrict the HTTP method or is bound to any domain constraints, as the SiteMatcher has done that already.

The concept of the PageRouter is to resolve, and to generate URIs. On top, it is a facade to hide the dependency to symfony and to not expose its logic.

Definition at line 70 of file PageRouter.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Routing\PageRouter::__construct ( Site  $site,
Context  $context = null 

A page router is always bound to a specific site.

Definition at line 82 of file PageRouter.php.

References TYPO3\CMS\Core\Routing\PageRouter\$context, and TYPO3\CMS\Core\Routing\PageRouter\$site.

Member Function Documentation

◆ assertMaximumStaticMappableAmount()

TYPO3\CMS\Core\Routing\PageRouter::assertMaximumStaticMappableAmount ( Route  $route,
array  $variableNames = [] 

Asserts that possible amount of items in all static and countable mappers (such as StaticRangeMapper) is limited to 10000 in order to avoid brute-force scenarios and the risk of cache-flooding.


Definition at line 569 of file PageRouter.php.

References TYPO3\CMS\Core\Routing\Route\filterAspects().

Referenced by TYPO3\CMS\Core\Routing\PageRouter\buildPageArguments().

◆ buildPageArguments()

TYPO3\CMS\Core\Routing\PageRouter::buildPageArguments ( Route  $route,
array  $results,
array  $remainingQueryParameters = [] 

Builds route arguments. The important part here is to distinguish between static and dynamic arguments. Per default all arguments are dynamic until aspects can be used to really consider them as static (= 1:1 mapping between route value and resulting arguments).

Besides that, internal arguments (_route, _controller, _custom, ..) have to be separated since those values are not meant to be used for later processing. Not separating those values might result in invalid cHash.

This method is used during resolving and generation of URLs.


Definition at line 513 of file PageRouter.php.

References TYPO3\CMS\Core\Routing\PageRouter\assertMaximumStaticMappableAmount(), TYPO3\CMS\Core\Routing\PageRouter\filterProcessedParameters(), TYPO3\CMS\Core\Routing\Route\getEnhancer(), and TYPO3\CMS\Core\Routing\PageRouter\resolveType().

Referenced by TYPO3\CMS\Core\Routing\PageRouter\matchRequest().

◆ filterProcessedParameters()

TYPO3\CMS\Core\Routing\PageRouter::filterProcessedParameters ( Route  $route,

Determine parameters that have been processed.


Definition at line 598 of file PageRouter.php.

Referenced by TYPO3\CMS\Core\Routing\PageRouter\buildPageArguments().

◆ generateCacheHash()

TYPO3\CMS\Core\Routing\PageRouter::generateCacheHash ( int  $pageId,
PageArguments  $arguments 

◆ getCacheHashParameters()

TYPO3\CMS\Core\Routing\PageRouter::getCacheHashParameters ( int  $pageId,
PageArguments  $arguments 

Definition at line 489 of file PageRouter.php.

Referenced by TYPO3\CMS\Core\Routing\PageRouter\generateCacheHash().

◆ getEnhancersForPage()

EnhancerInterface [] TYPO3\CMS\Core\Routing\PageRouter::getEnhancersForPage ( int  $pageId,
SiteLanguage  $language 

Fetch possible enhancers + aspects based on the current page configuration and the site configuration put into "routeEnhancers"


Definition at line 459 of file PageRouter.php.

Referenced by TYPO3\CMS\Core\Routing\PageRouter\matchRequest().

◆ getSlugCandidateProvider()

TYPO3\CMS\Core\Routing\PageRouter::getSlugCandidateProvider ( Context  $context)

◆ isRouteReallyValidForLanguage()

TYPO3\CMS\Core\Routing\PageRouter::isRouteReallyValidForLanguage ( Route  $route,
SiteLanguage  $siteLanguage 

Request may have been made with default page slug, also we are dealing with a site language variant. To avoid duplicate content, we need to revalidate that the eventually matched language route is really the available page language variant for the current lange. We do this at this late point to minimize the needed database queries instead of checking it for all build page candidates.

This is safe, as we can simply drop the route and having a correct page not found action delivered.

Definition at line 624 of file PageRouter.php.

References $GLOBALS, and TYPO3\CMS\Core\Site\Entity\SiteLanguage\getLanguageId().

Referenced by TYPO3\CMS\Core\Routing\PageRouter\matchRequest().

◆ matchRequest()

RouteResultInterface PageArguments TYPO3\CMS\Core\Routing\PageRouter::matchRequest ( ServerRequestInterface  $request,
RouteResultInterface  $previousResult = null 

◆ resolveMountPointParameterIntoPageSlug()

TYPO3\CMS\Core\Routing\PageRouter::resolveMountPointParameterIntoPageSlug ( int  $pageId,
string  $pagePath,
array  $mountPointPairs,
PageRepository  $pageRepository 

When a MP parameter is given, the mount point parameter is resolved, and the slug of the new page is added while the same parts of the original pagePath is removed (before). This way, the subpage to a mounted page has now a different "base" (= prefixed with the slug of the mount point).

This is done recursively when multiple mount point parameter pairs

string$pagePath‪the original path of the page
array$mountPointPairs‪an array with MP pairs (like ['13-3', '4-2'] for recursive mount points)

Definition at line 408 of file PageRouter.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getMountPointInfo(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPage(), and TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

◆ resolveType()

TYPO3\CMS\Core\Routing\PageRouter::resolveType ( Route  $route,
array &  $remainingQueryParameters 

Retrieves type from processed route and modifies remaining query parameters.

array$remainingQueryParameters‪reference to remaining query parameters

Definition at line 547 of file PageRouter.php.

Referenced by TYPO3\CMS\Core\Routing\PageRouter\buildPageArguments().

Member Data Documentation

◆ $aspectFactory

AspectFactory TYPO3\CMS\Core\Routing\PageRouter::$aspectFactory

Definition at line 74 of file PageRouter.php.

◆ $cacheHashCalculator

CacheHashCalculator TYPO3\CMS\Core\Routing\PageRouter::$cacheHashCalculator

Definition at line 75 of file PageRouter.php.

◆ $context

Context TYPO3\CMS\Core\Routing\PageRouter::$context

◆ $enhancerFactory

EnhancerFactory TYPO3\CMS\Core\Routing\PageRouter::$enhancerFactory

Definition at line 73 of file PageRouter.php.

◆ $requestContextFactory

RequestContextFactory TYPO3\CMS\Core\Routing\PageRouter::$requestContextFactory

Definition at line 77 of file PageRouter.php.

◆ $site

Site TYPO3\CMS\Core\Routing\PageRouter::$site

Definition at line 72 of file PageRouter.php.

Referenced by TYPO3\CMS\Core\Routing\PageRouter\__construct().