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

Breadcrumb

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

function Template::yield

Return value

iterable<scalar|\Stringable|null>

2 calls to Template::yield()
Template::display in vendor/twig/twig/src/Template.php
Template::render in vendor/twig/twig/src/Template.php

File

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

Class

Template
Default base class for compiled templates.

Namespace

Twig

Code

public function yield(array $context, array $blocks = []) : iterable {
    $context += $this->env
        ->getGlobals();
    $blocks = array_merge($this->blocks, $blocks);
    try {
        yield from $this->doDisplay($context, $blocks);
    } catch (Error $e) {
        if (!$e->getSourceContext()) {
            $e->setSourceContext($this->getSourceContext());
        }
        // this is mostly useful for \Twig\Error\LoaderError exceptions
        // see \Twig\Error\LoaderError
        if (-1 === $e->getTemplateLine()) {
            $e->guess();
        }
        throw $e;
    } catch (\Throwable $e) {
        $e = new RuntimeError(\sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
        $e->guess();
        throw $e;
    }
}

API Navigation

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