class AlligatorCategoryExtension extends Twig_Extension

Class AlligatorCategoryExtension is injected as twig.extension.alligator.category service. AlligatorCategoryExtension handles the logic and provides necessary data for managed entity in twig.

Properties

protected CategoryManager $categoryManager

Methods

__construct(CategoryManager $categoryManager)

Constructor

getFunctions()

{@inheritdoc}

mixed
getFeaturedCats(int $max = 6)

Get featured categories limit with max argument

string
getName()

Returns the name of the extension.

QueryBuilder|null
getRootCategories(null $limit = null)

Get root categories

QueryBuilder|null
getTreeCategories(bool $useFromCache = true)

Get tree categories from cache or cache them

QueryBuilder|null
geMegaMenuCategories()

Get megamenu category tree from cache

string
getCategoryFromRequestSlug()

Get category from request slug

array|string
geCategoriesForBackend(bool|false $displayNonVisible = false, bool|true $useCache = true)

Get categories for backend

setTreeCategoriesToCache(null $locale = null, bool $useFromCache = true, string|null $slug = null)

Set tree categories to cache

setMegaMenuCategoriesToCache(string $locale = null)

Set megamenu categories to cache

setFooterLayoutToCash()

Set footer layout to cache

array
getAllCategories()

Get all categories fro frontend

mixed
setAllCategoriesToCache()

Set all categories to cache

setNewRequest(Request $request)

Set new request

mixed|null
getParentCategorySlug(string $slug)

Get parent category slug

bool
handleHasActiveCategories(null $category = null, null $oldParent = null)

Update has visible categories on parent change

array|string
getAllSubcategories(Category $category, string $locale, bool|false $displayNonVisible = false, array $visibleCategories = null)

Get all subcategories for category and locale

Details

at line 67
__construct(CategoryManager $categoryManager)

Constructor

Parameters

CategoryManager $categoryManager

at line 75
getFunctions()

{@inheritdoc}

at line 96
mixed getFeaturedCats(int $max = 6)

Get featured categories limit with max argument

Parameters

int $max

Return Value

mixed

at line 106
string getName()

Returns the name of the extension.

Return Value

string The extension name

at line 117
QueryBuilder|null getRootCategories(null $limit = null)

Get root categories

Parameters

null $limit

Return Value

QueryBuilder|null

at line 132
QueryBuilder|null getTreeCategories(bool $useFromCache = true)

Get tree categories from cache or cache them

Parameters

bool $useFromCache

Return Value

QueryBuilder|null

at line 149
QueryBuilder|null geMegaMenuCategories()

Get megamenu category tree from cache

Return Value

QueryBuilder|null

at line 164
string getCategoryFromRequestSlug()

Get category from request slug

Return Value

string

at line 176
array|string geCategoriesForBackend(bool|false $displayNonVisible = false, bool|true $useCache = true)

Get categories for backend

Parameters

bool|false $displayNonVisible
bool|true $useCache

Return Value

array|string

at line 207
setTreeCategoriesToCache(null $locale = null, bool $useFromCache = true, string|null $slug = null)

Set tree categories to cache

Parameters

null $locale
bool $useFromCache
string|null $slug

at line 307
setMegaMenuCategoriesToCache(string $locale = null)

Set megamenu categories to cache

Parameters

string $locale | null $locale

at line 378
setFooterLayoutToCash()

Set footer layout to cache

at line 387
array getAllCategories()

Get all categories fro frontend

Return Value

array

at line 402
mixed setAllCategoriesToCache()

Set all categories to cache

Return Value

mixed

at line 411
setNewRequest(Request $request)

Set new request

Parameters

Request $request

at line 424
mixed|null getParentCategorySlug(string $slug)

Get parent category slug

Parameters

string $slug

Return Value

mixed|null

Exceptions

DBALException

at line 442
bool handleHasActiveCategories(null $category = null, null $oldParent = null)

Update has visible categories on parent change

Parameters

null $category
null $oldParent

Return Value

bool

Exceptions

Exception

at line 450
CategoryManager getCategoryManager()

Return Value

CategoryManager

at line 464
array|string getAllSubcategories(Category $category, string $locale, bool|false $displayNonVisible = false, array $visibleCategories = null)

Get all subcategories for category and locale

Parameters

Category $category
string $locale
bool|false $displayNonVisible
array $visibleCategories

Return Value

array|string