Skip to content

Commit 8a73a48

Browse files
committed
Show real template path in Twig debug if different from the name
1 parent fb470e1 commit 8a73a48

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Twig/Template.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@ protected function getDispatcher()
2323
public function display(array $context, array $blocks = array())
2424
{
2525
if ($this->env->isDebug()) {
26+
$source = $this->getSourceContext();
27+
$name = $source->getName();
28+
$path = str_replace(DRUPAL_ROOT . '/', '', $source->getPath());
29+
2630
print('<!-- TWIG DEBUG -->');
27-
printf('<!-- Template: %s -->', $this->getTemplateName());
31+
printf('<!-- Template: %s -->', $name);
32+
33+
if ($name !== $path) {
34+
printf('<!-- Path: %s -->', $path);
35+
}
2836
}
2937

3038
foreach ($context as $k => $var) {

0 commit comments

Comments
 (0)