class BlockElementsExtension extends Twig_Extension

Class BlockElementsExtension is injected as empire_block_elements_extension service. BlockElementsExtension handles the logic and provides necessary data for managed entity in twig.

Constants

BLOCK_ELEMENT_PATH

Path to generated block elements

Properties

protected BlockElementsManager $blockElementsManager

Methods

__construct(BlockElementsManager $blockElementsManager, Twig_Environment $environment, mixed $cache)

No description

getFunctions()

{@inheritdoc}

getFilters()

{@inheritdoc}

array
getProductsByIds(array $ids)

Get array of products for array of ids

array
getProductsByAlgorithm(string $algorithm, int $numberOfProducts)

Get array of products for algorithm

array
getCategories(array $ids)

Get array of categories for array of ids

array
getAttributeValues(array $ids)

Get array of attribute values for array of ids

array
getBrands(array $ids)

Get array of brands for array of ids

array
getAllBlocksForPageBuilder()

Get array of all blocks available for page builder

getBlockForId(Twig_Environment $twigEnvironment, int $id)

No description

string
prepareTitle(string $title)

Prepare block title

parseForBlock(Twig_Environment $twigEnvironment, string $string)

No description

array
renderBlockForId(mixed $id)

Get array containing title and rendered twig for block id

array
getBlockElementsById(array $ids)

Get multiple rendered blocks

string
getCachedBlockElement(string $template, string $locale)

Get block element from cache

string
getName()

No description

Details

at line 63
__construct(BlockElementsManager $blockElementsManager, Twig_Environment $environment, mixed $cache)

Parameters

BlockElementsManager $blockElementsManager
Twig_Environment $environment
mixed $cache

at line 73
getFunctions()

{@inheritdoc}

at line 104
getFilters()

{@inheritdoc}

at line 125
array getProductsByIds(array $ids)

Get array of products for array of ids

Parameters

array $ids

Return Value

array

at line 137
array getProductsByAlgorithm(string $algorithm, int $numberOfProducts)

Get array of products for algorithm

Parameters

string $algorithm
int $numberOfProducts

Return Value

array

at line 148
array getCategories(array $ids)

Get array of categories for array of ids

Parameters

array $ids

Return Value

array

at line 159
array getAttributeValues(array $ids)

Get array of attribute values for array of ids

Parameters

array $ids

Return Value

array

at line 170
array getBrands(array $ids)

Get array of brands for array of ids

Parameters

array $ids

Return Value

array

at line 179
array getAllBlocksForPageBuilder()

Get array of all blocks available for page builder

Return Value

array

at line 193
getBlockForId(Twig_Environment $twigEnvironment, int $id)

Parameters

Twig_Environment $twigEnvironment
int $id

Exceptions

NonUniqueResultException
Twig_Error_Loader
Twig_Error_Runtime
Twig_Error_Syntax

at line 212
string prepareTitle(string $title)

Prepare block title

Parameters

string $title

Return Value

string

at line 231
bool|simple_html_dom parseForBlock(Twig_Environment $twigEnvironment, string $string)

Parameters

Twig_Environment $twigEnvironment
string $string

Return Value

bool|simple_html_dom

at line 257
array renderBlockForId(mixed $id)

Get array containing title and rendered twig for block id

Parameters

mixed $id

Return Value

array

Exceptions

NonUniqueResultException
Twig_Error_Loader
Twig_Error_Runtime
Twig_Error_Syntax

at line 276
array getBlockElementsById(array $ids)

Get multiple rendered blocks

Parameters

array $ids

Return Value

array

Exceptions

NonUniqueResultException
Twig_Error_Loader
Twig_Error_Runtime
Twig_Error_Syntax

at line 298
string getCachedBlockElement(string $template, string $locale)

Get block element from cache

Parameters

string $template
string $locale

Return Value

string

Exceptions

Twig_Error_Loader
Twig_Error_Runtime
Twig_Error_Syntax

at line 312
string getName()

Return Value

string The extension name