class BaseHook

The base class for hook. If you provide hooks in your module you have to extends this class.

These class provides some helper functions to retrieve object from the current session of the current user. It also provides a render function that allows you to get the right template file from different locations and allows you to override templates in your current template.

Class BaseHook

Constants

INJECT_TEMPLATE_METHOD_NAME

Properties

BaseModule $module
ParserInterface $parser
TranslatorInterface $translator
AssetResolverInterface $assetsResolver
EventDispatcherInterface $dispatcher

Methods

insertTemplate( HookRenderEvent $event, string $code)

This function is called when hook uses the automatic insert template.

string
render( string $templateName, array $parameters = array())

helper function allowing you to render a template using a template engine

string
dump( string $fileName)

helper function allowing you to get the content of a file

string
addCSS( string $fileName, array $attributes = array(), array $filters = array())

helper function allowing you to generate the HTML link tag

string
addJS( string $fileName, array $attributes = array(), array $filters = array())

helper function allowing you to generate the HTML script tag

setModule( BaseModule $module)

No description

getModule()

No description

setParser( ParserInterface $parser)

No description

getParser()

No description

addTemplate( string $hookCode, string $value)

Add a new template for automatic render

array
getTemplates()

No description

Details

at line 91
insertTemplate( HookRenderEvent $event, string $code)

This function is called when hook uses the automatic insert template.

Parameters

HookRenderEvent $event
string $code

at line 134
string render( string $templateName, array $parameters = array())

helper function allowing you to render a template using a template engine

Parameters

string $templateName the template path of the template
array $parameters an array of parameters to assign to a template engine

Return Value

string the content generated by a template engine

at line 155
string dump( string $fileName)

helper function allowing you to get the content of a file

Parameters

string $fileName the template path of the template

Return Value

string the content of the file

at line 180
string addCSS( string $fileName, array $attributes = array(), array $filters = array())

helper function allowing you to generate the HTML link tag

Parameters

string $fileName the path to the css file
array $attributes the attributes of the tag
array $filters an array of assets processing filters (less, sass, etc.)

Return Value

string the link tag

at line 211
string addJS( string $fileName, array $attributes = array(), array $filters = array())

helper function allowing you to generate the HTML script tag

Parameters

string $fileName the path to the js file
array $attributes the attributes of the tag
array $filters an array of assets processing filters (cofeescript, compress, etc.)

Return Value

string the script tag

at line 236
setModule( BaseModule $module)

Parameters

BaseModule $module

at line 244
BaseModule getModule()

Return Value

BaseModule

at line 252
setParser( ParserInterface $parser)

Parameters

ParserInterface $parser

at line 260
ParserInterface getParser()

Return Value

ParserInterface

at line 406
addTemplate( string $hookCode, string $value)

Add a new template for automatic render

Parameters

string $hookCode the code of the hook (the name of the event used to render) : 'hook.{type}.{hook code}'
string $value list of the template to render or add. eg: 'render:mytemplate.html;css:assets/css/mycss.css;js:assets/js/myjs.js'

at line 418
array getTemplates()

Return Value

array templates