You are here

protected function TemplateManager::getNames in Devel 8.3

Same name and namespace in other branches
  1. 8 webprofiler/src/Profiler/TemplateManager.php \Drupal\webprofiler\Profiler\TemplateManager::getNames()
  2. 8.2 webprofiler/src/Profiler/TemplateManager.php \Drupal\webprofiler\Profiler\TemplateManager::getNames()
  3. 4.x webprofiler/src/Profiler/TemplateManager.php \Drupal\webprofiler\Profiler\TemplateManager::getNames()

Gets template names of templates that are present in the viewed profile.

Parameters

\Symfony\Component\HttpKernel\Profiler\Profile $profile:

Return value

array

Throws

\UnexpectedValueException

2 calls to TemplateManager::getNames()
TemplateManager::getName in webprofiler/src/Profiler/TemplateManager.php
Gets the template name for a given panel.
TemplateManager::getTemplates in webprofiler/src/Profiler/TemplateManager.php
Gets the templates for a given profile.

File

webprofiler/src/Profiler/TemplateManager.php, line 103

Class

TemplateManager
Profiler Templates Manager.

Namespace

Drupal\webprofiler\Profiler

Code

protected function getNames(Profile $profile) {
  $templates = [];
  foreach ($this->templates as $arguments) {
    if (NULL === $arguments) {
      continue;
    }
    list($name, $template) = $arguments;
    if (!$this->profiler
      ->has($name) || !$profile
      ->hasCollector($name)) {
      continue;
    }
    if ('.html.twig' === substr($template, -10)) {
      $template = substr($template, 0, -10);
    }
    if (!$this->twigLoader
      ->exists($template . '.html.twig')) {
      throw new \UnexpectedValueException(sprintf('The profiler template "%s.html.twig" for data collector "%s" does not exist.', $template, $name));
    }
    $templates[$name] = $template . '.html.twig';
  }
  return $templates;
}