You are here

function twig_source in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Extension/Core.php \twig_source()

Returns a template content without rendering it.

Parameters

Twig_Environment $env:

string $name The template name:

bool $ignoreMissing Whether to ignore missing templates or not:

Return value

string The template source

1 string reference to 'twig_source'
Twig_Extension_Core::getFunctions in vendor/twig/twig/lib/Twig/Extension/Core.php

File

vendor/twig/twig/lib/Twig/Extension/Core.php, line 1486

Code

function twig_source(Twig_Environment $env, $name, $ignoreMissing = false) {
  try {
    return $env
      ->getLoader()
      ->getSource($name);
  } catch (Twig_Error_Loader $e) {
    if (!$ignoreMissing) {
      throw $e;
    }
  }
}