RestrictedTranslatableRoute
extends TranslatableRoute
in package
Table of Contents
Properties
- $defaultLocale : string
- $derivedParameterCallbacks : array<string, array{source: string, callback: callable}>
- $name : string
- $reverseCallbacks : array<string, callable>
- $stringTranslationCallbacks : array<string, array{slugToId: callable, idToSlug: callable}>
- $translationCallbacks : array<string, callable>
- $restrictedParameters : array<string, array<string|int, int>>
Methods
- __construct() : mixed
- addDerivedParameter() : self
- addStringTranslation() : self
- addTranslation() : self
- constructUrl() : string|null
- match() : array<string|int, mixed>|null
- restrictParameter() : self
- setDefaultLocale() : static
- Locale of a URL without the locale prefix: the main localization (`localizations.main`), set by {@see RouterDispatcher} for every dynamic front route; the constructor default `cs` is only the fallback.
- setName() : static
- findIdInAnyLocale() : int|null
- Finds the id of a slug in any known locale: target locale first, then the default, then a fixed list of common locales.
Properties
$defaultLocale
protected
string
$defaultLocale
= 'cs'
$derivedParameterCallbacks
protected
array<string, array{source: string, callback: callable}>
$derivedParameterCallbacks
= []
$name
protected
string
$name
= ''
$reverseCallbacks
protected
array<string, callable>
$reverseCallbacks
= []
$stringTranslationCallbacks
protected
array<string, array{slugToId: callable, idToSlug: callable}>
$stringTranslationCallbacks
= []
$translationCallbacks
protected
array<string, callable>
$translationCallbacks
= []
$restrictedParameters
private
array<string, array<string|int, int>>
$restrictedParameters
= []
allowed id values per parameter name
Methods
__construct()
public
__construct(string $mask[, array<string|int, mixed>|string $metadata = [] ][, string $defaultLocale = 'cs' ]) : mixed
Parameters
- $mask : string
- $metadata : array<string|int, mixed>|string = []
- $defaultLocale : string = 'cs'
addDerivedParameter()
public
addDerivedParameter(string $paramName, string $sourceParam, callable $callback) : self
Parameters
- $paramName : string
- $sourceParam : string
- $callback : callable
Return values
selfaddStringTranslation()
public
addStringTranslation(string $paramName, callable $slugToId, callable $idToSlug) : self
Parameters
- $paramName : string
- $slugToId : callable
- $idToSlug : callable
Return values
selfaddTranslation()
public
addTranslation(string $paramName, callable $translator, callable $reverse) : self
Parameters
- $paramName : string
- $translator : callable
- $reverse : callable
Return values
selfconstructUrl()
public
constructUrl(array<string|int, mixed> $params, UrlScript $refUrl) : string|null
Parameters
- $params : array<string|int, mixed>
- $refUrl : UrlScript
Return values
string|nullmatch()
public
match(IRequest $httpRequest) : array<string|int, mixed>|null
Parameters
- $httpRequest : IRequest
Return values
array<string|int, mixed>|nullrestrictParameter()
public
restrictParameter(string $paramName, array<string|int, int> $allowedIds) : self
Parameters
- $paramName : string
- $allowedIds : array<string|int, int>
Return values
selfsetDefaultLocale()
Locale of a URL without the locale prefix: the main localization (`localizations.main`), set by {@see RouterDispatcher} for every dynamic front route; the constructor default `cs` is only the fallback.
public
setDefaultLocale(string $defaultLocale) : static
Parameters
- $defaultLocale : string
Return values
staticsetName()
public
setName(string $name) : static
Parameters
- $name : string
Return values
staticfindIdInAnyLocale()
Finds the id of a slug in any known locale: target locale first, then the default, then a fixed list of common locales.
protected
findIdInAnyLocale(string $slug, string $paramName, string $targetLocale) : int|null
Parameters
- $slug : string
- $paramName : string
- $targetLocale : string