private function getBlockByName($name, $resourcesName)
{
if (isset($this->blocks[$name])) {
return [$name => $this->blocks[$name]];
}
foreach ($this->{$resourcesName} as &$template) {
if (!$template instanceof Twig_Template) {
$template = $this->twig->loadTemplate($template['template']);
}
$tpl = $template;
$block = $this->searchBlock($name, $tpl);
if ($block !== null) {
$this->blocks[$name] = $block;
return [$name => $block];
}
}
throw new MissingFieldBlockException("Cannot find '{$name}' template block.");
}