CoolCMS API

ProductDetailRouteFactory extends BaseRouteFactory
in package

Builds the route of the product set detail in the catalog.

Mask: [<loc>/]<slug>/<name>-s<id>. Only id is matched; name is an SEO decoration that addDerivedParameter() fills in when a URL is generated from the id. The parse-direction closure of addStringTranslation() always returns null, so an arbitrary or outdated name in the URL still leads to the correct product.

Table of Contents

Properties

$routeManager  : RouteManager
$pageSlugTranslator  : PageSlugTranslator
$productSetNameTranslator  : ProductSetNameTranslator

Methods

__construct()  : mixed
create()  : RestrictedTranslatableRoute
Creates the `TranslatableRoute` instance.
applyWhitelist()  : void
Restricts a route parameter to the page ids whitelisted in the route definition.
getPageIdsFromEntity()  : array<string|int, int>
Returns the allowed page ids from the route definition (precomputed, no database query).

Properties

Methods

create()

Creates the `TranslatableRoute` instance.

public create(string $mask, string $module, string $presenter, string $action[, int|null $routeId = null ][, RouteDefinition|null $routeEntity = null ]) : RestrictedTranslatableRoute
Parameters
$mask : string

URL mask (e.g. '/[]')

$module : string

module name (System, Blog, ...)

$presenter : string

presenter name (Page, Article, ...)

$action : string

action name (show, detail, ...)

$routeId : int|null = null

route id from the database

$routeEntity : RouteDefinition|null = null

already loaded definition with its pages

Return values
RestrictedTranslatableRoute

applyWhitelist()

Restricts a route parameter to the page ids whitelisted in the route definition.

protected applyWhitelist(RestrictedTranslatableRoute $route[, RouteDefinition|null $routeEntity = null ][, string $paramName = 'slug' ]) : void
Parameters
$route : RestrictedTranslatableRoute

route to restrict

$routeEntity : RouteDefinition|null = null

definition with precomputed allowed pages; null applies no restriction

$paramName : string = 'slug'

parameter to restrict (default 'slug')

getPageIdsFromEntity()

Returns the allowed page ids from the route definition (precomputed, no database query).

protected getPageIdsFromEntity(RouteDefinition $routeEntity) : array<string|int, int>
Parameters
$routeEntity : RouteDefinition
Return values
array<string|int, int>
On this page

Search results