Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Template.php

function Template::getParent

Returns the parent template.

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

Return value

self|TemplateWrapper|false The parent template or false if there is no parent

5 calls to Template::getParent()
Template::getBlockNames in vendor/twig/twig/src/Template.php
Returns all block names in the current context of the template.
Template::hasBlock in vendor/twig/twig/src/Template.php
Returns whether a block exists or not in the current context of the template.
Template::hasMacro in vendor/twig/twig/src/Template.php
Template::yieldBlock in vendor/twig/twig/src/Template.php
Template::yieldParentBlock in vendor/twig/twig/src/Template.php
Yields a parent block.

File

vendor/twig/twig/src/Template.php, line 77

Class

Template
Default base class for compiled templates.

Namespace

Twig

Code

public function getParent(array $context) : self|TemplateWrapper|false {
    if (null !== $this->parent) {
        return $this->parent;
    }
    if (!($parent = $this->doGetParent($context))) {
        return false;
    }
    if ($parent instanceof self || $parent instanceof TemplateWrapper) {
        return $this->parents[$parent->getSourceContext()
            ->getName()] = $parent;
    }
    if (!isset($this->parents[$parent])) {
        $this->parents[$parent] = $this->loadTemplate($parent);
    }
    return $this->parents[$parent];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal