class AlligatorPluginExtension extends Twig_Extension

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

Constants

HTML_F_TAG_KEY

CACHED_PLUGINS_LAYOUTS

CACHED_ACTIVE_PLUGINS_LAYOUTS

Properties

static string $pluginsFileFullPath
static bool $recordLayoutNames Shout extension record all calls
static array $layoutNamesArray Array to hold all layout names

Methods

__construct(Client $cache)

AlligatorPluginExtension constructor.

getFunctions()

{@inheritdoc}

static array
getAllPlugins(string|null $pluginMainPathInput = null)

Find all plugins

mixed
doEvalFunction(string $string)

Execute string as command

getPluginForLayout(Twig_Environment $twigEnvironment, mixed $layoutName = null, array $data = array())

Render and display all templates for layout. If $recordLayoutNames is TRUE, save layout names for later use

mixed|null
getTemplatesForLayout(string $layoutName, bool $uniqueLayout = false)

Find all templates for specific layout. If $uniqueLayout is TRUE then only one template can be registered for specified layout

string
getName()

Returns the name of the extension.

static 
setPluginsFileFullPath(string $pluginsFileFullPath)

No description

static string|null
getPluginsFileFullPath()

No description

string
putAllInTag(Twig_Environment $twigEnvironment, string $key, array $data = [], string $type = 'script', bool $cachable = true, int $lifeTime = 0)

Returns script or style tag, from cache or directly from file

static array
generateLayouts(mixed $themeViews, mixed $themeName = FRONTEND_THEME_TITLE, bool|true $onlyActivePlugins = true, bool|true $findActiveTemplates = true)

Generate and cache all layouts

int
getCountForLayout(string $layoutName)

Get number of template for specific layout

string|bool
renderTwigTemplate(Twig_Environment $twigEnvironment, null $templateName = null, array $data = array())

Prepare data and render template from theme, otherwise from plugin

Details

at line 88
__construct(Client $cache)

AlligatorPluginExtension constructor.

Parameters

Client $cache

at line 103
getFunctions()

{@inheritdoc}

at line 121
static array getAllPlugins(string|null $pluginMainPathInput = null)

Find all plugins

Parameters

string|null $pluginMainPathInput

Return Value

array

at line 154
mixed doEvalFunction(string $string)

Execute string as command

Parameters

string $string

Return Value

mixed

at line 172
getPluginForLayout(Twig_Environment $twigEnvironment, mixed $layoutName = null, array $data = array())

Render and display all templates for layout. If $recordLayoutNames is TRUE, save layout names for later use

Parameters

Twig_Environment $twigEnvironment
mixed $layoutName
array $data

Exceptions

Exception

at line 193
mixed|null getTemplatesForLayout(string $layoutName, bool $uniqueLayout = false)

Find all templates for specific layout. If $uniqueLayout is TRUE then only one template can be registered for specified layout

Parameters

string $layoutName
bool $uniqueLayout

Return Value

mixed|null

Exceptions

Exception

at line 216
string getName()

Returns the name of the extension.

Return Value

string The extension name

at line 224
static setPluginsFileFullPath(string $pluginsFileFullPath)

Parameters

string $pluginsFileFullPath

at line 232
static string|null getPluginsFileFullPath()

Return Value

string|null

at line 256
string putAllInTag(Twig_Environment $twigEnvironment, string $key, array $data = [], string $type = 'script', bool $cachable = true, int $lifeTime = 0)

Returns script or style tag, from cache or directly from file

Parameters

Twig_Environment $twigEnvironment Twig environment
string $key Twig key
array $data Array for files. All files must be the same type
string $type Type to create, this can be style or style
bool $cachable Put to cache and read from it or not
int $lifeTime The lifetime in number of seconds for this cache entry. If zero (the default), the entry never expires (although it may be deleted from the cache to make place for other entries)

Return Value

string

Exceptions

Exception

at line 291
static array generateLayouts(mixed $themeViews, mixed $themeName = FRONTEND_THEME_TITLE, bool|true $onlyActivePlugins = true, bool|true $findActiveTemplates = true)

Generate and cache all layouts

Parameters

mixed $themeViews
mixed $themeName
bool|true $onlyActivePlugins
bool|true $findActiveTemplates

Return Value

array

at line 351
int getCountForLayout(string $layoutName)

Get number of template for specific layout

Parameters

string $layoutName

Return Value

int

at line 364
string|bool renderTwigTemplate(Twig_Environment $twigEnvironment, null $templateName = null, array $data = array())

Prepare data and render template from theme, otherwise from plugin

Parameters

Twig_Environment $twigEnvironment
null $templateName
array $data

Return Value

string|bool