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

Breadcrumb

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

function StringLoaderExtension::templateFromString

Loads a template from a string.

{{ include(template_from_string("Hello {{ name }}")) }}

@internal

Parameters

string|null $name An optional name of the template to be used in error messages:

1 call to StringLoaderExtension::templateFromString()
twig_template_from_string in vendor/twig/twig/src/Resources/string_loader.php
@internal

File

vendor/twig/twig/src/Extension/StringLoaderExtension.php, line 36

Class

StringLoaderExtension

Namespace

Twig\Extension

Code

public static function templateFromString(Environment $env, string|\Stringable $template, ?string $name = null) : TemplateWrapper {
    return $env->createTemplate((string) $template, $name);
}

API Navigation

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