PageSlugCandidateProvider
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.
Table of Contents
Properties
Methods
- __construct() : mixed
- getCandidatesForPath() : array<int, array<string, mixed>>
- Fetches an array of possible URLs that match the current site + language (incl. fallbacks)
- getRealPageIdForPageIdAsPossibleCandidate() : int|null
- 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.
- findPageCandidatesOfMountPoint() : array<string|int, mixed>
- 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).
- getCandidateSlugsFromRoutePath() : array<string|int, string>
- Returns possible URL parts for a string like /home/about-us/offices/ or /home/about-us/offices.json to return.
- getDecoratingEnhancers() : array<string|int, DecoratingEnhancerInterface>
- 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.
- getPagesFromDatabaseForCandidates() : array<string|int, array<string|int, mixed>>|array<string|int, mixed>
- Check for records in the database which matches one of the slug candidates.
- getRoutePathRedecorationPattern() : string
- Gets all patterns that can be used to redecorate (undecorate) a potential previously decorated route path.
Properties
$context
protected
Context
$context
$enhancerFactory
protected
EnhancerFactory
$enhancerFactory
$site
protected
Site
$site
Methods
__construct()
public
__construct(Context $context, Site $site, EnhancerFactory|null $enhancerFactory) : mixed
Parameters
- $context : Context
- $site : Site
- $enhancerFactory : EnhancerFactory|null
getCandidatesForPath()
Fetches an array of possible URLs that match the current site + language (incl. fallbacks)
public
getCandidatesForPath(string $urlPath, SiteLanguage $language) : array<int, array<string, mixed>>
Parameters
- $urlPath : string
- $language : SiteLanguage
Return values
array<int, array<string, mixed>>getRealPageIdForPageIdAsPossibleCandidate()
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.
public
getRealPageIdForPageIdAsPossibleCandidate(int $pageId) : int|null
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.
Parameters
- $pageId : int
Return values
int|nullfindPageCandidatesOfMountPoint()
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).
protected
findPageCandidatesOfMountPoint(array<string|int, mixed> $mountPointPage, array<string|int, mixed> $mountedPage, Site $siteOfMountedPage, int $languageId, array<string|int, mixed> $slugCandidates) : array<string|int, mixed>
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.
Parameters
- $mountPointPage : array<string|int, mixed>
-
the page with doktype=7
- $mountedPage : array<string|int, mixed>
-
the target page where the mountpoint is pointing to
- $siteOfMountedPage : Site
-
the site of the target page, which could be different from the current page
- $languageId : int
-
the current language id
- $slugCandidates : array<string|int, mixed>
-
the existing slug candidates that were looked for previously
Return values
array<string|int, mixed> —more candidates
getCandidateSlugsFromRoutePath()
Returns possible URL parts for a string like /home/about-us/offices/ or /home/about-us/offices.json to return.
protected
getCandidateSlugsFromRoutePath(string $routePath) : array<string|int, string>
/home/about-us/offices/ /home/about-us/offices.json /home/about-us/offices /home/about-us/ /home/about-us /home/ /home /
Parameters
- $routePath : string
Return values
array<string|int, string>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.
protected
getDecoratingEnhancers() : array<string|int, DecoratingEnhancerInterface>
Return values
array<string|int, DecoratingEnhancerInterface>getPagesFromDatabaseForCandidates()
Check for records in the database which matches one of the slug candidates.
protected
getPagesFromDatabaseForCandidates(array<string|int, mixed> $slugCandidates, int $languageId[, array<string|int, mixed> $excludeUids = [] ]) : array<string|int, array<string|int, mixed>>|array<string|int, mixed>
Parameters
- $slugCandidates : array<string|int, mixed>
- $languageId : int
- $excludeUids : array<string|int, mixed> = []
-
when called recursively this is the mountpoint parameter of the original prefix
Tags
Return values
array<string|int, array<string|int, mixed>>|array<string|int, mixed>getRoutePathRedecorationPattern()
Gets all patterns that can be used to redecorate (undecorate) a potential previously decorated route path.
protected
getRoutePathRedecorationPattern() : string
Return values
string —regular expression pattern capable of redecorating