abstract class Twig_Template

Default base class for compiled templates.

This class is an implementation detail of how template compilation currently works, which might change. It should never be used directly. Use $twig->load() instead, which returns an instance of Twig_TemplateWrapper.

Constants

ANY_CALL

ARRAY_CALL

METHOD_CALL

Properties

static protected $cache
protected $parent
protected $parents
protected $env
protected $blocks
protected $traits

Methods

__construct(Twig_Environment $env)

No description

__toString()

No description

string
getTemplateName()

Returns the template name.

array
getDebugInfo()

Returns debug information about the template.

getSourceContext()

Returns information about the original template source code.

getParent(array $context)

Returns the parent template.

doGetParent(array $context)

No description

isTraitable()

No description

displayParentBlock(string $name, array $context, array $blocks = array())

Displays a parent block.

displayBlock(string $name, array $context, array $blocks = array(), bool $useBlocks = true)

Displays a block.

string
renderParentBlock(string $name, array $context, array $blocks = array())

Renders a parent block.

string
renderBlock(string $name, array $context, array $blocks = array(), bool $useBlocks = true)

Renders a block.

bool
hasBlock(string $name, array $context, array $blocks = array())

Returns whether a block exists or not in the current context of the template.

array
getBlockNames(array $context, array $blocks = array())

Returns all block names in the current context of the template.

loadTemplate($template, $templateName = null, $line = null, $index = null)

No description

array
getBlocks()

Returns all blocks.

display(array $context, array $blocks = array())

No description

render(array $context)

No description

displayWithErrorHandling(array $context, array $blocks = array())

No description

doDisplay(array $context, array $blocks = array())

Auto-generated method to display the template with the given context.

Details

at line 41
__construct(Twig_Environment $env)

Parameters

Twig_Environment $env

at line 49
__toString()

at line 59
abstract string getTemplateName()

Returns the template name.

Return Value

string The template name

at line 68
abstract array getDebugInfo()

Returns debug information about the template.

Return Value

array Debug information

at line 75
Twig_Source getSourceContext()

Returns information about the original template source code.

Return Value

Twig_Source

at line 92
Twig_Template|false getParent(array $context)

Returns the parent template.

This method is for internal use only and should never be called directly.

Parameters

array $context

Return Value

Twig_Template|false The parent template or false if there is no parent

at line 122
protected doGetParent(array $context)

Parameters

array $context

at line 127
isTraitable()

at line 144
displayParentBlock(string $name, array $context, array $blocks = array())

Displays a parent block.

This method is for internal use only and should never be called directly.

Parameters

string $name The block name to display from the parent
array $context The context
array $blocks The current set of blocks

at line 168
displayBlock(string $name, array $context, array $blocks = array(), bool $useBlocks = true)

Displays a block.

This method is for internal use only and should never be called directly.

Parameters

string $name The block name to display
array $context The context
array $blocks The current set of blocks
bool $useBlocks Whether to use the current set of blocks

at line 228
string renderParentBlock(string $name, array $context, array $blocks = array())

Renders a parent block.

This method is for internal use only and should never be called directly.

Parameters

string $name The block name to render from the parent
array $context The context
array $blocks The current set of blocks

Return Value

string The rendered block

at line 251
string renderBlock(string $name, array $context, array $blocks = array(), bool $useBlocks = true)

Renders a block.

This method is for internal use only and should never be called directly.

Parameters

string $name The block name to render
array $context The context
array $blocks The current set of blocks
bool $useBlocks Whether to use the current set of blocks

Return Value

string The rendered block

at line 273
bool hasBlock(string $name, array $context, array $blocks = array())

Returns whether a block exists or not in the current context of the template.

This method checks blocks defined in the current template or defined in "used" traits or defined in parent templates.

Parameters

string $name The block name
array $context The context
array $blocks The current set of blocks

Return Value

bool true if the block exists, false otherwise

at line 303
array getBlockNames(array $context, array $blocks = array())

Returns all block names in the current context of the template.

This method checks blocks defined in the current template or defined in "used" traits or defined in parent templates.

Parameters

array $context The context
array $blocks The current set of blocks

Return Value

array An array of block names

at line 314
protected loadTemplate($template, $templateName = null, $line = null, $index = null)

Parameters

$template
$templateName
$line
$index

at line 359
array getBlocks()

Returns all blocks.

This method is for internal use only and should never be called directly.

Return Value

array An array of blocks

at line 364
display(array $context, array $blocks = array())

Parameters

array $context
array $blocks

at line 369
render(array $context)

Parameters

array $context

at line 386
protected displayWithErrorHandling(array $context, array $blocks = array())

Parameters

array $context
array $blocks

at line 414
abstract protected doDisplay(array $context, array $blocks = array())

Auto-generated method to display the template with the given context.

Parameters

array $context An array of parameters to pass to the template
array $blocks An array of blocks to pass to the template