Como acompanhar erros

O validador de código Twig ajuda a identificar e corrigir erros em templates, como tags quebradas ou mal formadas.

Funcionamento do Validador

  • Mensagens de erro são exibidas diretamente na interface.
  • As mensagens indicam o ponto exato do problema no código.

Exemplo de Erro

Unexpected "endfor" tag (expecting closing tag for the "if" tag defined near line 13) in "template" at line 15.

Como Resolver

  1. Revise o código próximo à linha indicada.
  2. Certifique-se de que todas as tags estão devidamente fechadas.

Código Antes da Correção

    {% for section in sections %}
        {% if section.visible %}
            {% include 'sections/' ~ section.section_alias ~ '.twig' with section %}
    {% endfor %}

Código Após a Correção

    {% for section in sections %}
        {% if section.visible %}
            {% include 'sections/' ~ section.section_alias ~ '.twig' with section %}
        {% endif %}
    {% endfor %}

Salve as alterações e verifique se o erro foi resolvido.