1

I'm working with Twig templates, and often see messages like this in the browser when I make a mistake:

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Twig\Error\SyntaxError</em>: Unclosed &quot;{&quot;. in <em class="placeholder">Twig\Lexer-&gt;lexExpression()</em> (line <em class="placeholder">153</em> of <em class="placeholder">themes/mytheme/templates/page.html.twig</em>). <pre class="backtrace">Twig\Lexer-&gt;lexBlock() (Line: 126)
Twig\Lexer-&gt;tokenize(Object) (Line: 705)

...etc.

Is there a way to automatically render the above HTML rather than having it output as a string? Thanks.

6
  • Are you creating that message, or is this a message the system or a contributed module is creating?
    – Jaypan
    Commented Dec 8, 2019 at 1:28
  • @Jaypan I'm editing Twig templates inside my custom theme. I believe this is a PHP message is emitted by Drupal core.
    – apostl3pol
    Commented Dec 8, 2019 at 1:41
  • Ok, sorry I don’t have an answer then.
    – Jaypan
    Commented Dec 8, 2019 at 1:44
  • I say embrace the error as is then fix your mistake :)
    – taggartJ
    Commented Dec 8, 2019 at 22:20
  • 1
    This is fixed in Drupal 8.8.0, see drupal.org/project/drupal/issues/2924860
    – 4uk4
    Commented Dec 8, 2019 at 23:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.