Example #1
1
 public function findAllBlocks(\Twig_Template $template, array $context)
 {
     if (false !== ($parent = $template->getParent($context))) {
         return array_unique(array_merge($this->findAllBlocks($parent, $context), $template->getBlockNames()));
     }
     return $template->getBlockNames();
 }
Example #2
0
 /**
  * Twig block not found in template.
  *
  * @param array          $blocks
  * @param \Twig_Template $template
  *
  * @return TemplateException
  */
 public static function twigBlockNotFound(array $blocks, \Twig_Template $template)
 {
     return new self(sprintf('None of "%s" twig blocks found, present ones are: "".', implode('", "', $blocks), implode('", "', $template->getBlockNames())));
 }