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

Breadcrumb

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

function Environment::load

Loads a template.

Parameters

string|TemplateWrapper $name The template name:

Throws

LoaderError When the template cannot be found

RuntimeError When a previously generated cache is corrupted

SyntaxError When an error occurred during compilation

1 call to Environment::load()
Environment::resolveTemplate in vendor/twig/twig/src/Environment.php
Tries to load a template consecutively from an array.

File

vendor/twig/twig/src/Environment.php, line 346

Class

Environment
Stores the Twig configuration and renders templates.

Namespace

Twig

Code

public function load($name) : TemplateWrapper {
    if ($name instanceof TemplateWrapper) {
        return $name;
    }
    if ($name instanceof Template) {
        trigger_deprecation('twig/twig', '3.9', 'Passing a "%s" instance to "%s" is deprecated.', self::class, __METHOD__);
        return $name;
    }
    return new TemplateWrapper($this, $this->loadTemplate($this->getTemplateClass($name), $name));
}
RSS feed
Powered by Drupal