You are here

public function Twig_Template::getParent in Translation template extractor 6.3

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

Returns the parent template.

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

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/Template.php
Displays a block.
Twig_Template::displayParentBlock in vendor/Twig/Template.php
Displays a parent block.

File

vendor/Twig/Template.php, line 63

Class

Twig_Template
Default base class for compiled templates.

Code

public function getParent(array $context) {
  if (null !== $this->parent) {
    return $this->parent;
  }
  $parent = $this
    ->doGetParent($context);
  if (false === $parent) {
    return false;
  }
  elseif ($parent instanceof Twig_Template) {
    $name = $parent
      ->getTemplateName();
    $this->parents[$name] = $parent;
    $parent = $name;
  }
  elseif (!isset($this->parents[$parent])) {
    $this->parents[$parent] = $this->env
      ->loadTemplate($parent);
  }
  return $this->parents[$parent];
}