I am trying to render a template with my controller but does not work it show me this error :
LogicException: The controller must return a response (
Hello Bob!
given). in Symfony\Component\HttpKernel\HttpKernel->handleRaw() (line 163 of core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php).
My function :
public function helloAction($name) {
$twigFilePath = drupal_get_path('module', 'acme') . '/templates/hello.html.twig';
$template = $this->twig->loadTemplate($twigFilePath);
return $template->render(array('name' => $name));
}
return new Response($template->render(array('name' => $name)));
should do it for you although I can't be sure as I've only used the templating component as part of the Symfony framework. – qooplmao