{% try %} {% set menu = gantry.menu.instance(particle) %} {% catch %}
{{ e.getMessage }}
{% endtry %} {% macro getCustomWidth(item, menu, mode, dropdown_type) -%} {%- if (item.width|default('auto') != 'auto') and not (dropdown_type == 'fullwidth' and item.level > 1) -%} {%- if mode == 'item' %} style="position: relative;" {%- elseif mode == 'submenu' %} style="width:{{ item.width }};" data-g-item-width="{{ item.width }}" {%- endif %} {%- endif %} {%- endmacro %} {% macro displayParticle(item, context) %} {% set context = context|merge({ particle: item.options.particle }) %} {% set classes = item.options.block.class %} {% endmacro %} {% macro displayTitle(item) %} {% if not item.icon_only or not (item.image or item.icon) %} {{ item.title }} {% if item.subtitle %} {{ item.subtitle }} {% endif %} {% endif %} {% endmacro %} {% macro displayItem(item, menu, context, dropdown_type) %} {% import _self as self %} {% if item.type == 'particle' and not item.options.particle.enabled %} {% set enabled = 0 %} {% endif %} {% if item.visible and item.enabled and enabled|default(1) %} {% set title = item.icon_only or item.link_title ? ' title="' ~ item.link_title|default(item.title)|e ~ '"' %} {% set label = item.icon_only and (item.image or item.icon) ? ' aria-label="' ~ item.title|e ~'"' %} {% set active = menu.isActive(item) ? ' active' %} {% set dropdown = item.level == 1 ? ' g-' ~ item.getDropdown() %} {% set parent = item.children ? ' g-parent' %} {% set target = (item.target != '_self' or context.particle.forceTarget) ? ' target="' ~ item.target|e ~ '"' %} {% set rel = item.rel %} {% if item.target == '_blank' %} {% if 'noopener' not in rel %} {% set rel = rel ? rel ~ ' ' : rel %} {% set rel = rel ~ 'noopener' %} {% endif %} {% if 'noreferrer' not in rel %} {% set rel = rel ? rel ~ ' ' : rel %} {% set rel = rel ~ 'noreferrer' %} {% endif %} {% endif %} {% set listAttributes = item.attributes|attribute_array %} {% set linkAttributes = '' %} {% if item.link_attributes %} {% for attribute in item.link_attributes %} {% for key, value in attribute %} {% if key == 'rel' %} {% for hVal in value|split(' ') %} {% if hVal not in rel %} {% set rel = rel ? rel ~ ' ' : rel %} {% set rel = rel ~ hVal %} {% endif %} {% endfor %} {% else %} {% set linkAttributes = linkAttributes ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %} {% endif %} {% endfor %} {% endfor %} {% endif %} {% set rel = rel ? ' rel="' ~ rel|e('html_attr') ~ '"' %} {% endif %} {% endmacro %} {% macro displayContainers(item, menu, context, dropdown_type) %} {% import _self as self %}
{% set groups = item.getDropdown() == 'standard' ? [item] : item.groups %} {% for column, items in groups %}
{% endfor %}
{% endmacro %} {% macro displayItems(items, menu, context, dropdown_type) %} {% import _self as self %} {% for item in items %} {% if item.level == 1 %}{% set dropdown_type = item.dropdown %}{% endif %} {{ self.displayItem(item, menu, context, dropdown_type) }} {% endfor %} {% endmacro %} {% macro displaySubmenu(item, menu, context, dropdown_type) %} {% import _self as self %} {% if not item.dropdown_hide %} {% set animation = context.gantry.config.get('styles.menu.animation')|default('g-fade') %} {% if ((item.groups|length == 1 and not dropdown_type == 'fullwidth') or dropdown_type == 'standard') or (item.width|default('auto') != 'auto' and dropdown_type == 'fullwidth')%}{% set dropdown_dir = 'g-dropdown-' ~ item.dropdown_dir|default('right') %}{% endif %} {% endif %} {% endmacro %} {% import _self as macro %} {% if menu.root.count() %} {% endif %}