Craft 3 Class Reference

Abstract Class craft\web\twig\Template

Inheritance
craft\web\twig\Template ยป Twig_Template
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/web/twig/Template.php

Base Twig template class.

Protected Properties
Property Type Description Defined By
$blocks Twig_Template
$env Twig_Template
$extensions Twig_Template
$parent Twig_Template
$parents Twig_Template
$traits Twig_Template
Public Methods
Method Description Defined By
__construct() Twig_Template
__toString() Twig_Template
display() craft\web\twig\Template
displayBlock() Displays a block. Twig_Template
displayParentBlock() Displays a parent block. Twig_Template
getBlockNames() Returns all block names in the current context of the template. Twig_Template
getBlocks() Returns all blocks. Twig_Template
getDebugInfo() Returns debug information about the template. Twig_Template
getParent() Returns the parent template. Twig_Template
getSourceContext() Returns information about the original template source code. Twig_Template
getTemplateName() Returns the template name. Twig_Template
hasBlock() Returns whether a block exists or not in the current context of the template. Twig_Template
isTraitable() Twig_Template
render() Twig_Template
renderBlock() Renders a block. Twig_Template
renderParentBlock() Renders a parent block. Twig_Template
Protected Methods
Method Description Defined By
displayWithErrorHandling() Displays the template. craft\web\twig\Template
doDisplay() Auto-generated method to display the template with the given context. Twig_Template
doGetParent() Twig_Template
loadTemplate() Twig_Template
Constants
Constant Value Description Defined By
ANY_CALL 'any' Twig_Template
ARRAY_CALL 'array' Twig_Template
METHOD_CALL 'method' Twig_Template

Method Details

display() public method #

public void display ( array $context, array $blocks = [] )
$context
$blocks

displayWithErrorHandling() protected method #

Displays the template.

protected void displayWithErrorHandling ( array $context, array $blocks = [] )
$context array
$blocks array
throws Twig_Error
throws Twig_Error_Runtime