You are here

tb-megamenu-item.html.twig in The Better Mega Menu 8

Same filename and directory in other branches
  1. 2.x templates/tb-megamenu-item.html.twig
{% set linkAttributes = link['attributes'] %}
{% if ( link['url'] is defined and link['url'] is not empty ) %}
  {% set tag = "a" %}
  {% set href = " href='#{ link['url'] }'" %}
{% else  %}
  {% set tag = 'span' %}
  {% set href = '' %}
  {% set linkAttributes = linkAttributes.addClass('tb-megamenu-no-link').setAttribute('tabindex', '0') %}
  {% if submenu is empty %}
    {% set linkAttributes = linkAttributes.addClass('tb-megamenu-no-submenu') %}
  {% endif %}
{% endif %}
<li {{ attributes }} >
  <{{ tag }}{{ href|raw }} {{ link['attributes'] }}>
    {% if  item_config['xicon'] %}
      <i class="{{ item_config['xicon'] }}"></i>
    {% endif %}
    {{ link.title_translate|t }}
    {% if submenu and block_config['auto-arrow'] %}
      <span class="caret"></span>
    {% endif %}
    {% if item_config['caption'] %}
      <span class="mega-caption"> {{ item_config['caption']|t }}</span>
    {% endif %}
  </{{ tag }}>
  {{ submenu }}
</li>

File

templates/tb-megamenu-item.html.twig
View source
  1. {% set linkAttributes = link['attributes'] %}
  2. {% if ( link['url'] is defined and link['url'] is not empty ) %}
  3. {% set tag = "a" %}
  4. {% set href = " href='#{ link['url'] }'" %}
  5. {% else %}
  6. {% set tag = 'span' %}
  7. {% set href = '' %}
  8. {% set linkAttributes = linkAttributes.addClass('tb-megamenu-no-link').setAttribute('tabindex', '0') %}
  9. {% if submenu is empty %}
  10. {% set linkAttributes = linkAttributes.addClass('tb-megamenu-no-submenu') %}
  11. {% endif %}
  12. {% endif %}
  13. <li {{ attributes }} >
  14. <{{ tag }}{{ href|raw }} {{ link['attributes'] }}>
  15. {% if item_config['xicon'] %}
  16. <i class="{{ item_config['xicon'] }}"></i>
  17. {% endif %}
  18. {{ link.title_translate|t }}
  19. {% if submenu and block_config['auto-arrow'] %}
  20. <span class="caret"></span>
  21. {% endif %}
  22. {% if item_config['caption'] %}
  23. <span class="mega-caption"> {{ item_config['caption']|t }}</span>
  24. {% endif %}
  25. </{{ tag }}>
  26. {{ submenu }}
  27. </li>