function Environment::getTemplateClass
Gets the template class associated with the given string.
The generated template class is based on the following parameters:
- The cache key for the given template;
- The currently enabled extensions;
- PHP version;
- Twig version;
- Options with what environment was created.
@internal
Parameters
string $name The name for which to calculate the template class name:
int|null $index The index if it is an embedded template:
5 calls to Environment::getTemplateClass()
- Environment::createTemplate in vendor/
twig/ twig/ src/ Environment.php - Creates a template from source.
- Environment::load in vendor/
twig/ twig/ src/ Environment.php - Loads a template.
- Environment::removeCache in vendor/
twig/ twig/ src/ Environment.php - TwigEnvironment::getTemplateClass in core/
lib/ Drupal/ Core/ Template/ TwigEnvironment.php - Gets the template class associated with the given string.
- TwigEnvironment::getTemplateClass in core/
lib/ Drupal/ Core/ Template/ TwigEnvironment.php - Gets the template class associated with the given string.
1 method overrides Environment::getTemplateClass()
- TwigEnvironment::getTemplateClass in core/
lib/ Drupal/ Core/ Template/ TwigEnvironment.php - Gets the template class associated with the given string.
File
-
vendor/
twig/ twig/ src/ Environment.php, line 302
Class
- Environment
- Stores the Twig configuration and renders templates.
Namespace
TwigCode
public function getTemplateClass(string $name, ?int $index = null) : string {
$key = ($this->hotCache[$name] ?? $this->getLoader()
->getCacheKey($name)) . $this->optionsHash;
return '__TwigTemplate_' . hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $key) . (null === $index ? '' : '___' . $index);
}