function HelpTopicTwigLoader::findTemplate

Same name in other branches
  1. 9 core/modules/help_topics/src/HelpTopicTwigLoader.php \Drupal\help_topics\HelpTopicTwigLoader::findTemplate()
  2. 10 core/modules/help/src/HelpTopicTwigLoader.php \Drupal\help\HelpTopicTwigLoader::findTemplate()
1 call to HelpTopicTwigLoader::findTemplate()
HelpTopicTwigLoader::getSourceContext in core/modules/help/src/HelpTopicTwigLoader.php

File

core/modules/help/src/HelpTopicTwigLoader.php, line 99

Class

HelpTopicTwigLoader
Loads help topic Twig files from the filesystem.

Namespace

Drupal\help

Code

protected function findTemplate($name, $throw = TRUE) {
    if (!str_ends_with($name, '.html.twig')) {
        if (!$throw) {
            return NULL;
        }
        $extension = pathinfo($name, PATHINFO_EXTENSION);
        throw new LoaderError(sprintf("Help topic %s has an invalid file extension (%s). Only help topics ending .html.twig are allowed.", $name, $extension));
    }
    return parent::findTemplate($name, $throw);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.