mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
Merge remote branch 'hason/template'
* hason/template: deleted abstract method doDisplay (maintain BC) added possibility to customize "display" in the base template class
This commit is contained in:
@@ -164,7 +164,7 @@ class Twig_Node_Module extends Twig_Node
|
||||
protected function compileDisplayHeader(Twig_Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->write("public function display(array \$context, array \$blocks = array())\n", "{\n")
|
||||
->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n")
|
||||
->indent()
|
||||
;
|
||||
}
|
||||
|
||||
@@ -156,6 +156,17 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
return array_keys($this->blocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the template with the given context.
|
||||
*
|
||||
* @param array $context An array of parameters to pass to the template
|
||||
* @param array $blocks An array of blocks to pass to the template
|
||||
*/
|
||||
public function display(array $context, array $blocks = array())
|
||||
{
|
||||
$this->doDisplay($context, $blocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the template with the given context and returns it as string.
|
||||
*
|
||||
|
||||
@@ -34,8 +34,9 @@ interface Twig_TemplateInterface
|
||||
* Displays the template with the given context.
|
||||
*
|
||||
* @param array $context An array of parameters to pass to the template
|
||||
* @param array $blocks An array of blocks to pass to the template
|
||||
*/
|
||||
function display(array $context);
|
||||
function display(array $context, array $blocks = array());
|
||||
|
||||
/**
|
||||
* Returns the bound environment for this template.
|
||||
|
||||
@@ -67,7 +67,7 @@ class Twig_Tests_Node_ModuleTest extends Twig_Tests_Node_TestCase
|
||||
/* foo.twig */
|
||||
class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
|
||||
{
|
||||
public function display(array \$context, array \$blocks = array())
|
||||
protected function doDisplay(array \$context, array \$blocks = array())
|
||||
{
|
||||
\$context = array_merge(\$this->env->getGlobals(), \$context);
|
||||
|
||||
@@ -105,7 +105,7 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
|
||||
return \$this->parent;
|
||||
}
|
||||
|
||||
public function display(array \$context, array \$blocks = array())
|
||||
protected function doDisplay(array \$context, array \$blocks = array())
|
||||
{
|
||||
\$context = array_merge(\$this->env->getGlobals(), \$context);
|
||||
|
||||
@@ -150,7 +150,7 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
|
||||
return \$this->parent;
|
||||
}
|
||||
|
||||
public function display(array \$context, array \$blocks = array())
|
||||
protected function doDisplay(array \$context, array \$blocks = array())
|
||||
{
|
||||
\$context = array_merge(\$this->env->getGlobals(), \$context);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class Twig_Tests_Node_SandboxedModuleTest extends Twig_Tests_Node_TestCase
|
||||
/* foo.twig */
|
||||
class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
|
||||
{
|
||||
public function display(array \$context, array \$blocks = array())
|
||||
protected function doDisplay(array \$context, array \$blocks = array())
|
||||
{
|
||||
\$this->checkSecurity();
|
||||
\$context = array_merge(\$this->env->getGlobals(), \$context);
|
||||
@@ -115,7 +115,7 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
|
||||
return \$this->parent;
|
||||
}
|
||||
|
||||
public function display(array \$context, array \$blocks = array())
|
||||
protected function doDisplay(array \$context, array \$blocks = array())
|
||||
{
|
||||
\$context = array_merge(\$this->env->getGlobals(), \$context);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
class Twig_TemplateTest extends Twig_Template
|
||||
{
|
||||
public function display(array $context)
|
||||
protected function doDisplay(array $context, array $blocks = array())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user