Skip to content

{% if true%}{% block ... %}{%endif%} #351

Description

@Schrank

Hey,

i posted this issue on the mailingliste, but I didn't get any response. I am not sure wether I understand all ideas behind twig but I think this is a bug:

I tried the following and it doesn't work the way I wanted it to work:
{% if type == 0 %}
{% block menuHandbooks %}currentmenu{% endblock %}
{% endif %}
{% if type == 1 %}
{% block menuDocuments %}currentmenu{% endblock %}
{% endif %}
{% if type == 2 %}
{% block menuBetProgram %}currentmenu{% endblock %}
{% endif %}

Is it intended, that all conditions are true? I had a template which was inherited {% extends '::admin.html.twig' %}
and with the above example, the template gets his own body.

The idea is to mark the current page in the menu.

I rebuild it this way and now it works:
{% block menuHandbooks %}
{% if type == 0 %}currentmenu{% endif %}
{% endblock %}

{% block menuDocuments %}
{% if type == 1 %}currentmenu{% endif %}
{% endblock %}

{% block menuBetProgram %}
{% if type == 2 %}currentmenu{% endif %}
{% endblock %}

Best regards
Fabian

P.S. Part from the admin.html.twig:

  • Nachrichten
  • Dokumente
  • Handbücher
  • Lernvideos
  • Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      No labels
      No labels

      Type

      No type

      Fields

      No fields configured for issues without a type.

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions