Skip to content

Commit

Permalink
Replace twig_render_template() with \Drupal::service('twig')->loadTem…
Browse files Browse the repository at this point in the history
…plate() (#4294)

* Replace twig_render_template() with \Drupal::service('twig')->loadTemplate()

Loading the template ensures the compiled template is cached. It is not necessary to also render it.

* Use the DI-ed twig service
  • Loading branch information
ceesgeene committed Jul 18, 2020
1 parent 221441a commit d1bd6bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Drupal/Commands/core/TwigCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ public function twigCompile()
->in($searchpaths);
foreach ($files as $file) {
$relative = Path::makeRelative($file->getRealPath(), Drush::bootstrapManager()->getRoot());
// @todo Dynamically disable twig debugging since there is no good info there anyway.
twig_render_template($relative, ['theme_hook_original' => '']);
// Loading the template ensures the compiled template is cached.
$this->getTwig()->loadTemplate($relative);
$this->logger()->success(dt('Compiled twig template !path', ['!path' => $relative]));
}
}
Expand Down

0 comments on commit d1bd6bf

Please sign in to comment.