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

Breadcrumb

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

function HelpTopicTwigLoader::findTemplate

Overrides FilesystemLoader::findTemplate

1 call to HelpTopicTwigLoader::findTemplate()
HelpTopicTwigLoader::getSourceContext in core/modules/help/src/HelpTopicTwigLoader.php
Returns the source context for a given template logical name.

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);
}

API Navigation

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