[TwigBundle] fixed inheritance problem
This commit is contained in:
parent
67c9fdf412
commit
e2ea634df4
@ -261,9 +261,8 @@ class FormExtension extends \Twig_Extension
|
||||
$resource = $this->environment->loadTemplate($resource);
|
||||
}
|
||||
|
||||
// an array of blockName => template
|
||||
$blocks = array();
|
||||
foreach ($resource->getBlockNames() as $name) {
|
||||
foreach ($this->getBlockNames($resource) as $name) {
|
||||
$blocks[$name] = $resource;
|
||||
}
|
||||
|
||||
@ -273,6 +272,17 @@ class FormExtension extends \Twig_Extension
|
||||
return $templates;
|
||||
}
|
||||
|
||||
protected function getBlockNames($resource)
|
||||
{
|
||||
$names = $resource->getBlockNames();
|
||||
$parent = $resource;
|
||||
while (false !== $parent = $parent->getParent(array())) {
|
||||
$names = array_merge($names, $parent->getBlockNames());
|
||||
}
|
||||
|
||||
return array_unique($names);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the extension.
|
||||
*
|
||||
|
Reference in New Issue
Block a user