You are here

public function Twig_Template::getParent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Template.php \Twig_Template::getParent()

Returns the parent template.

This method is for internal use only and should never be called directly.

@internal

Parameters

array $context:

Return value

Twig_TemplateInterface|false The parent template or false if there is no parent

2 calls to Twig_Template::getParent()
Twig_Template::displayBlock in vendor/twig/twig/lib/Twig/Template.php
Displays a block.
Twig_Template::displayParentBlock in vendor/twig/twig/lib/Twig/Template.php
Displays a parent block.

File

vendor/twig/twig/lib/Twig/Template.php, line 67

Class

Twig_Template
Default base class for compiled templates.

Code

public function getParent(array $context) {
  if (null !== $this->parent) {
    return $this->parent;
  }
  try {
    $parent = $this
      ->doGetParent($context);
    if (false === $parent) {
      return false;
    }
    if ($parent instanceof self) {
      return $this->parents[$parent
        ->getTemplateName()] = $parent;
    }
    if (!isset($this->parents[$parent])) {
      $this->parents[$parent] = $this
        ->loadTemplate($parent);
    }
  } catch (Twig_Error_Loader $e) {
    $e
      ->setTemplateFile(null);
    $e
      ->guess();
    throw $e;
  }
  return $this->parents[$parent];
}