custom/plugins/S360MegaMenu/src/Resources/views/storefront/s360/megamenu/desktop/items/link.html.twig line 1

Open in your IDE?
  1. {#
  2.  # Default link menu item
  3.  #}
  4. {# @var menu \S360\MegaMenu\Core\Content\Menu\MenuEntity #}
  5. {% block s360_megamenu_item %}
  6.     {# @var item \S360\MegaMenu\Core\Content\Menu\MenuItemEntity #}
  7.     {% set item = treeItem.item %}
  8.     {% set title = item.translated.title %}
  9.     {% set isActive = menu.tree.active.id == item.id or (item.linkType == "category" and item.link is same as(page.header.navigation.active.id)) %}
  10.     {% set url = item.link %}
  11.     {% set noopener = false %}
  12.     {% set isFolder = item.categoryLink and item.categoryLink.type == 'folder' %}
  13.     {% if item.linkType == "category" and item.categoryLink %}
  14.         {% set url = category_url(item.categoryLink) %}
  15.     {% elseif item.linkType == 'custom' and url starts with url('frontend.home.page') == false and url starts with path('frontend.home.page') == false %}
  16.         {% set noopener = true %}
  17.     {% endif %}
  18.     <div class="s360-megamenu__item {% if item.align == 'right' %}s360-megamenu__item--right{% else %}s360-megamenu__item--default{% endif %}">
  19.         {% block s360_megamenu_item_link %}
  20.             {# Use a span tag if we only want to show text instead of a link #}
  21.             {% block s360_megamenu_item_link_tag_open %}
  22.                 <{% if item.linkType == 'none' or url is empty or isFolder %}span{% else %}a{% endif %}
  23.                     class="{% block s360_megamenu_item_classes %}
  24.                         s360-megamenu__link s360-megamenu__link--{{ item.id }} s360-megamenu__link--{{ item.linkType }}
  25.                         {% if (item.icon or item.customIcon) and not item.hideContent %} s360-megamenu__link--icon-with-text{% endif %}
  26.                         {% if isActive %} active{% endif %}
  27.                         {% if item.styling.customClass %}{{ item.styling.customClass }}{% endif %}
  28.                     {% endblock %}"
  29.                     {% if item.linkType != 'none' and url is not empty or not isFolder %}
  30.                         href="{{ url }}"
  31.                         itemprop="url"
  32.                         title="{{ title }}"
  33.                     {% endif %}
  34.                     {% if noopener %}
  35.                         target="_blank"
  36.                         rel="noopener"
  37.                     {% endif %}
  38.                     {% block s360_megamenu_item_attrs %}data-flyout-menu-trigger="{{ item.id }}"{% endblock %}
  39.                 >
  40.             {% endblock %}
  41.                 {# Icon Left #}
  42.                 {% if item.icon and (item.iconPosition == null or item.iconPosition == 'left') %}
  43.                     {% block s360_megamenu_item_link_icon_left %}
  44.                         {% sw_include '@Storefront/storefront/s360/megamenu/utilities/icon.html.twig' with { icon: item.icon, position: 'left' } %}
  45.                     {% endblock %}
  46.                 {% endif %}
  47.                 {# Image Left #}
  48.                 {% if item.customIcon and (item.iconPosition == null or item.iconPosition == 'left') %}
  49.                     {% block s360_megamenu_item_link_media_left %}
  50.                         <img src="{{ item.customIcon.url }}" alt="{{ title | sw_sanitize }}" class="img-fluid s360-megamenu__link__image s360-megamenu__link__image--left" />
  51.                     {% endblock %}
  52.                 {% endif %}
  53.                 {# Content #}
  54.                 {% if not item.hideContent %}
  55.                     {% block s360_megamenu_item_link_text_content %}
  56.                         <span itemprop="name">{{ title }}</span>
  57.                     {% endblock %}
  58.                 {% endif %}
  59.                 {# Icon Right #}
  60.                 {% if item.icon and item.iconPosition == 'right'%}
  61.                     {% block s360_megamenu_item_link_icon_right %}
  62.                         {% sw_include '@Storefront/storefront/s360/megamenu/utilities/icon.html.twig' with { icon: item.icon, position: 'right' } %}
  63.                     {% endblock %}
  64.                 {% endif %}
  65.                 {# Image Right #}
  66.                 {% if item.customIcon and item.iconPosition == 'right' %}
  67.                     {% block s360_megamenu_item_link_media_right %}
  68.                         <img src="{{ item.customIcon.url }}" alt="{{ title | sw_sanitize }}" class="img-fluid s360-megamenu__link__image s360-megamenu__link__image--right" />
  69.                     {% endblock %}
  70.                 {% endif %}
  71.                 {# Use a span tag if we only want to show text instead of a link #}
  72.                 {% block s360_megamenu_item_link_tag_close %}
  73.                     {% if item.linkType == 'none' or url is empty %}
  74.                         </span>
  75.                     {% else %}
  76.                         </a>
  77.                     {% endif %}
  78.                 {% endblock %}
  79.         {% endblock %}
  80.         {# Flyouts which are not fullscreen and therefore have to be added here in order to have the right positioning! #}
  81.         {% block s360_megamenu_item_flyouts %}
  82.             {% if (item.contentSettings.dropdownWidth == 'content' or item.contentSettings.dropdownWidth is not defined) and treeItem.shouldDisplayFlyout(page.header.activeLanguage.id) %}
  83.                 {% block s360_megamenu_item_flyout_container %}
  84.                     <div class="navigation-flyouts s360-megamenu__dropdown {% if menu.dropdownStyling.customClass %}{{ menu.dropdownStyling.customClass }}{% endif %}">
  85.                         {% block s360_megamenu_item_flyout %}
  86.                             {% sw_include '@Storefront/storefront/s360/megamenu/desktop/flyouts/' ~ item.contentType ~ '.html.twig' ignore missing with { treeItem: treeItem, item: item, menu: menu, includeFlyoutWrapper: true } %}
  87.                         {% endblock %}
  88.                     </div>
  89.                 {% endblock %}
  90.             {% endif %}
  91.         {% endblock %}
  92.     </div>
  93. {% endblock %}