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

Breadcrumb

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

function Template::yieldParentBlock

Yields a parent block.

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

Parameters

string $name The block name to display from the parent:

array $context The context:

array $blocks The current set of blocks:

Return value

iterable<scalar|\Stringable|null>

2 calls to Template::yieldParentBlock()
Template::displayParentBlock in vendor/twig/twig/src/Template.php
Displays a parent block.
Template::renderParentBlock in vendor/twig/twig/src/Template.php
Renders a parent block.

File

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

Class

Template
Default base class for compiled templates.

Namespace

Twig

Code

public function yieldParentBlock($name, array $context, array $blocks = []) : iterable {
    if (isset($this->traits[$name])) {
        yield from $this->traits[$name][0]
            ->yieldBlock($this->traitAliases[$name] ?? $name, $context, $blocks, false);
    }
    elseif ($parent = $this->getParent($context)) {
        yield from $parent->unwrap()
            ->yieldBlock($name, $context, $blocks, false);
    }
    else {
        throw new RuntimeError(\sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext());
    }
}

API Navigation

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