Issue #2201789 by joelpittet, jjcarrion, stefanos.petrakis, wiifm, Geizt, lussoluca | Cottser: Don't print '_theme()' in twig_debug output.

8.0.x
webchick 2014-10-05 09:28:19 -07:00
parent 1b21ebf347
commit 6e5fd14d91
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class TwigDebugMarkupTest extends WebTestBase {
$build = node_view($node); $build = node_view($node);
$output = drupal_render($build); $output = drupal_render($build);
$this->assertTrue(strpos($output, '<!-- THEME DEBUG -->') !== FALSE, 'Twig debug markup found in theme output when debug is enabled.'); $this->assertTrue(strpos($output, '<!-- THEME DEBUG -->') !== FALSE, 'Twig debug markup found in theme output when debug is enabled.');
$this->assertTrue(strpos($output, "CALL: _theme('node')") !== FALSE, 'Theme call information found.'); $this->assertTrue(strpos($output, "THEME HOOK: 'node'") !== FALSE, 'Theme call information found.');
$this->assertTrue(strpos($output, '* node--1--full' . $extension . PHP_EOL . ' x node--1' . $extension . PHP_EOL . ' * node--page--full' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node--full' . $extension . PHP_EOL . ' * node' . $extension) !== FALSE, 'Suggested template files found in order and node ID specific template shown as current template.'); $this->assertTrue(strpos($output, '* node--1--full' . $extension . PHP_EOL . ' x node--1' . $extension . PHP_EOL . ' * node--page--full' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node--full' . $extension . PHP_EOL . ' * node' . $extension) !== FALSE, 'Suggested template files found in order and node ID specific template shown as current template.');
$template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension; $template_filename = $templates['node__1']['path'] . '/' . $templates['node__1']['template'] . $extension;
$this->assertTrue(strpos($output, "BEGIN OUTPUT from '$template_filename'") !== FALSE, 'Full path to current template file found.'); $this->assertTrue(strpos($output, "BEGIN OUTPUT from '$template_filename'") !== FALSE, 'Full path to current template file found.');
@ -66,7 +66,7 @@ class TwigDebugMarkupTest extends WebTestBase {
$build = array('#theme' => 'node__foo__bar'); $build = array('#theme' => 'node__foo__bar');
$build += node_view($node3); $build += node_view($node3);
$output = drupal_render($build); $output = drupal_render($build);
$this->assertTrue(strpos($output, "CALL: _theme('node__foo__bar')") !== FALSE, 'Theme call information found.'); $this->assertTrue(strpos($output, "THEME HOOK: 'node__foo__bar'") !== FALSE, 'Theme call information found.');
$this->assertTrue(strpos($output, '* node--foo--bar' . $extension . PHP_EOL . ' * node--foo' . $extension . PHP_EOL . ' * node--3--full' . $extension . PHP_EOL . ' * node--3' . $extension . PHP_EOL . ' * node--page--full' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node--full' . $extension . PHP_EOL . ' x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.'); $this->assertTrue(strpos($output, '* node--foo--bar' . $extension . PHP_EOL . ' * node--foo' . $extension . PHP_EOL . ' * node--3--full' . $extension . PHP_EOL . ' * node--3' . $extension . PHP_EOL . ' * node--page--full' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node--full' . $extension . PHP_EOL . ' x node' . $extension) !== FALSE, 'Suggested template files found in order and base template shown as current template.');
// Disable debug, rebuild the service container, and clear all caches. // Disable debug, rebuild the service container, and clear all caches.

View File

@ -59,7 +59,7 @@ function twig_render_template($template_file, $variables) {
); );
if ($twig_service->isDebug()) { if ($twig_service->isDebug()) {
$output['debug_prefix'] .= "\n\n<!-- THEME DEBUG -->"; $output['debug_prefix'] .= "\n\n<!-- THEME DEBUG -->";
$output['debug_prefix'] .= "\n<!-- CALL: _theme('{$variables['theme_hook_original']}') -->"; $output['debug_prefix'] .= "\n<!-- THEME HOOK: '{$variables['theme_hook_original']}' -->";
// If there are theme suggestions, reverse the array so more specific // If there are theme suggestions, reverse the array so more specific
// suggestions are shown first. // suggestions are shown first.
if (!empty($variables['theme_hook_suggestions'])) { if (!empty($variables['theme_hook_suggestions'])) {