abstract class Twig_Template implements Twig_TemplateInterface
Default base class for compiled templates.
Methods
|
__construct(Twig_Environment $env)
Constructor. |
||
| string |
getTemplateName()
Returns the template name. |
|
| Twig_Environment |
getEnvironment()
Returns the bound environment for this template. |
|
| Twig_TemplateInterface|false |
getParent(array $context)
Returns the parent template. |
|
|
isTraitable()
|
||
|
displayParentBlock(string $name, array $context, array $blocks = array())
Displays a parent block. |
||
|
displayBlock(string $name, array $context, array $blocks = array())
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())
Renders a block. |
|
| Boolean |
hasBlock(string $name)
Returns whether a block exists or not. |
|
| array |
getBlockNames()
Returns all block names. |
|
| array |
getBlocks()
Returns all blocks. |
|
|
display(array $context, array $blocks = array())
Displays the template with the given context. |
||
| string |
render(array $context)
Renders the template with the given context and returns it as string. |
|
| static |
clearCache()
This method is only useful when testing Twig. |
Details
at line 33
public
__construct(Twig_Environment $env)
Constructor.
at line 45
abstract public string
getTemplateName()
Returns the template name.
at line 50
public Twig_Environment
getEnvironment()
Returns the bound environment for this template.
at line 63
public Twig_TemplateInterface|false
getParent(array $context)
Returns the parent template.
This method is for internal use only and should never be called directly.
at line 88
public
isTraitable()
at line 103
public
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.
at line 126
public
displayBlock(string $name, array $context, array $blocks = array())
Displays a block.
This method is for internal use only and should never be called directly.
at line 153
public 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.
at line 173
public string
renderBlock(string $name, array $context, array $blocks = array())
Renders a block.
This method is for internal use only and should never be called directly.
at line 198
public Boolean
hasBlock(string $name)
Returns whether a block exists or not.
This method is for internal use only and should never be called directly.
This method does only return blocks defined in the current template or defined in "used" traits.
It does not return blocks from parent templates as the parent template name can be dynamic, which is only known based on the current context.
at line 213
public array
getBlockNames()
Returns all block names.
This method is for internal use only and should never be called directly.
at line 228
public array
getBlocks()
Returns all blocks.
This method is for internal use only and should never be called directly.
at line 236
public
display(array $context, array $blocks = array())
Displays the template with the given context.
at line 244
public string
render(array $context)
Renders the template with the given context and returns it as string.
at line 451
static public
clearCache()
This method is only useful when testing Twig.
Do not use it.