CoolCMS API

CategoryTrait

Resolves the current category from the route parameter `category`.

The parameter is translated to an id by ProductCategoryNameTranslator (see ProductListRouteFactory), like Blog CategoryTrait. Falls back to a direct lookup through translations.href when the translator returns the raw string (route without route_factory, cache miss).

Table of Contents

Properties

$categorySlugTranslator  : ProductCategoryNameTranslator
Router translator; the same one that builds the slug from the id in links (see init below).
$currentCategory  : ProductCategory|null

Methods

getCurrentCategory()  : ProductCategory|null
initCurrentCategory()  : void
isCategoryBranchActive()  : bool
Whether the category and all its ancestors are active (nested set: an ancestor encloses lft/rgt).

Properties

Methods

isCategoryBranchActive()

Whether the category and all its ancestors are active (nested set: an ancestor encloses lft/rgt).

private isCategoryBranchActive(ProductCategory $category) : bool
Parameters
$category : ProductCategory
Return values
bool
On this page

Search results