templates/helpers/menu-link.html.twig line 1

Open in your IDE?
  1. {% import "/helpers/macros.html.twig" as macros %}
  2. {% set lang = app.request.locale %}
  3. {% set href = '' %}
  4. {% set text = '' %}
  5. {% set class = ['nav-link'] %}
  6. {% if classes is defined and classes is not null and classes is not empty %}
  7. {% set class = classes %}
  8. {% endif %}
  9. {%  if link %}
  10.     {% if link.linkType == 'internal' %}
  11.         {% if link.internalType == 'document' %}
  12.             {% set href = link.path %}
  13.             {% if link.text %}
  14.                 {% set text = link.text %}
  15.             {% else %}
  16.                 {% set text = pimcore_document(link.internal).properties.navigation_title.data %}
  17.             {% endif %}
  18.             {% if macros.isActiveNode(node, currentPagePath)|trim and active_classes is defined and active_classes is not null and active_classes is not empty %}
  19.                 {% set class = class|merge(active_classes) %}
  20.             {% endif %}
  21.             <a href="{{href}}" class="{{class|join(' ')}}">{{text}}</a>
  22.         {% elseif link.internalType == 'object' %}
  23.             {% set obj = pimcore_object(link.internal) %}
  24.     {#        {% if obj.slug is not null and obj.slug is not empty %}#}
  25.     {#            {% if obj.className == 'KitchenCategory' %}#}
  26.     {#                {% set href = kitchen_category_link(obj, lang) %}#}
  27.     {#            {% elseif obj.className == 'KitchenProgram' %}#}
  28.     {#                {% set href = kitchen_program_link(obj, lang) %}#}
  29.     {#            {% endif %}#}
  30.     {#            {% if link.text %}#}
  31.     {#                {% set text = link.text %}#}
  32.     {#            {% else %}#}
  33.     {#                {% set text = obj.name %}#}
  34.     {#            {% endif %}#}
  35.     {#            <a href="{{href}}" class="{{class}}">{{text}}</a>#}
  36.     {#        {% endif %}#}
  37.         {% endif %}
  38.     {% elseif link.linkType == 'direct' %}
  39.         <a href="{{link.direct}}" class="{{class|join(' ')}}">{{link.text}}</a>
  40.     {% endif %}
  41. {% endif %}