From: Fabien Potencier Date: Thu, 30 Sep 2010 08:10:16 +0000 (+0200) Subject: added Twig_Template::hasBlock() method X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=05578c8860ad109f13aba5337977e27f32c1a569;p=web%2Fkonrad%2Ftwig.git added Twig_Template::hasBlock() method --- diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index b4b4b92..bbbee48 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -36,11 +36,16 @@ abstract class Twig_Template implements Twig_TemplateInterface return $this->env; } - protected function getBlock($name, array $context) + public function getBlock($name, array $context) { return call_user_func($this->blocks[$name][0], $context, array_slice($this->blocks[$name], 1)); } + public function hasBlock($name) + { + return isset($this->blocks[$name][0]); + } + protected function getParent($context, $parents) { return call_user_func($parents[0], $context, array_slice($parents, 1));