‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Routing\PageSlugCandidateProvider Class Reference

Public Member Functions

 __construct (Context $context, Site $site, ?EnhancerFactory $enhancerFactory)
array< int, array< string, mixed > > getCandidatesForPath (string $urlPath, SiteLanguage $language)
 getRealPageIdForPageIdAsPossibleCandidate (int $pageId)

Protected Member Functions

string getRoutePathRedecorationPattern ()
DecoratingEnhancerInterface[] getDecoratingEnhancers ()
array[] array getPagesFromDatabaseForCandidates (array $slugCandidates, int $languageId, array $excludeUids=[])
array findPageCandidatesOfMountPoint (array $mountPointPage, array $mountedPage, Site $siteOfMountedPage, int $languageId, array $slugCandidates)
string[] getCandidateSlugsFromRoutePath (string $routePath)

Protected Attributes

Site $site
Context $context
EnhancerFactory $enhancerFactory

Detailed Description

Provides possible pages (from the database) that could match a certain URL path, but also works for fetching the best "slug" value for multi-lingual pages with a specific language requested.

as this API might change and a possible interface is given at some point.

Definition at line 42 of file PageSlugCandidateProvider.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Routing\PageSlugCandidateProvider::__construct ( Context  $context,
Site  $site,
?EnhancerFactory  $enhancerFactory 

Member Function Documentation

◆ findPageCandidatesOfMountPoint()

array TYPO3\CMS\Core\Routing\PageSlugCandidateProvider::findPageCandidatesOfMountPoint ( array  $mountPointPage,
array  $mountedPage,
Site  $siteOfMountedPage,
int  $languageId,
array  $slugCandidates 

Check if the page candidate is a mount point, if so, we need to re-start the slug candidates procedure with the mount point as a prefix (= context of the subpage).

Before doing the slugCandidates are adapted to remove the slug of the mount point (actively moving the pointer of the path to strip away the existing prefix), then checking for more pages.

Once possible candidates are found, the slug prefix needs to be re-added so the PageRouter finds the page, with an additional 'MPvar' attribute. However, all page candidates needs to be checked if they are connected in the proper mount page.

array$mountPointPage‪the page with doktype=7
array$mountedPage‪the target page where the mountpoint is pointing to
Site$siteOfMountedPage‪the site of the target page, which could be different from the current page
int$languageId‪the current language id
array$slugCandidates‪the existing slug candidates that were looked for previously
‪array more candidates

Definition at line 328 of file PageSlugCandidateProvider.php.

Referenced by TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getPagesFromDatabaseForCandidates().

◆ getCandidatesForPath()

array<int,array<string,mixed> > TYPO3\CMS\Core\Routing\PageSlugCandidateProvider::getCandidatesForPath ( string  $urlPath,
SiteLanguage  $language 

◆ getCandidateSlugsFromRoutePath()

string [] TYPO3\CMS\Core\Routing\PageSlugCandidateProvider::getCandidateSlugsFromRoutePath ( string  $routePath)

Returns possible URL parts for a string like /home/about-us/offices/ or /home/about-us/offices.json to return.

/home/about-us/offices/ /home/about-us/offices.json /home/about-us/offices /home/about-us/ /home/about-us /home/ /home /


Definition at line 429 of file PageSlugCandidateProvider.php.

References TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getRoutePathRedecorationPattern(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getCandidatesForPath().

◆ getDecoratingEnhancers()

DecoratingEnhancerInterface [] TYPO3\CMS\Core\Routing\PageSlugCandidateProvider::getDecoratingEnhancers ( )

Resolves decorating enhancers without having aspects assigned. These instances are used to pre-process URL path and MUST NOT be used for actually resolving or generating URL parameters.


Definition at line 159 of file PageSlugCandidateProvider.php.

Referenced by TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getRoutePathRedecorationPattern().

◆ getPagesFromDatabaseForCandidates()

array [] array TYPO3\CMS\Core\Routing\PageSlugCandidateProvider::getPagesFromDatabaseForCandidates ( array  $slugCandidates,
int  $languageId,
array  $excludeUids = [] 

Check for records in the database which matches one of the slug candidates.

array$excludeUids‪when called recursively this is the mountpoint parameter of the original prefix

Definition at line 179 of file PageSlugCandidateProvider.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_MOUNTPOINT, TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\findPageCandidatesOfMountPoint(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Database\Connection\PARAM_STR_ARRAY.

Referenced by TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getCandidatesForPath().

◆ getRealPageIdForPageIdAsPossibleCandidate()

TYPO3\CMS\Core\Routing\PageSlugCandidateProvider::getRealPageIdForPageIdAsPossibleCandidate ( int  $pageId)

Fetches the page without any language or other hidden/enable fields, but only takes "deleted" and "workspace" into account, as all other things will be evaluated later.

This is only needed for resolving the ACTUAL Page Id when index.php?id=13 was given

Should be rebuilt to return the actual Page ID considering the online ID of the page.


Definition at line 101 of file PageSlugCandidateProvider.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ getRoutePathRedecorationPattern()

string TYPO3\CMS\Core\Routing\PageSlugCandidateProvider::getRoutePathRedecorationPattern ( )

Gets all patterns that can be used to redecorate (undecorate) a potential previously decorated route path.

‪string regular expression pattern capable of redecorating

Definition at line 136 of file PageSlugCandidateProvider.php.

References TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getDecoratingEnhancers(), and TYPO3\CMS\Core\Routing\Enhancer\DecoratingEnhancerInterface\getRoutePathRedecorationPattern().

Referenced by TYPO3\CMS\Core\Routing\PageSlugCandidateProvider\getCandidateSlugsFromRoutePath().

Member Data Documentation

◆ $context

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

◆ $enhancerFactory

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

◆ $site

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