function Template::getBlockNames
Returns all block names in the current context of the template.
This method checks blocks defined in the current template or defined in "used" traits or defined in parent templates.
Parameters
array $context The context:
array $blocks The current set of blocks:
Return value
array<string> An array of block names
File
-
vendor/
twig/ twig/ src/ Template.php, line 259
Class
- Template
- Default base class for compiled templates.
Namespace
TwigCode
public function getBlockNames(array $context, array $blocks = []) : array {
$names = array_merge(array_keys($blocks), array_keys($this->blocks));
if ($parent = $this->getParent($context)) {
$names = array_merge($names, $parent->getBlockNames($context));
}
return array_unique($names);
}