{% spaceless %} {# Parameters: - "links" (array) (default: []): format: [ { "label" (string) (default: '') Label of link "path" (string) (default: '') Url of link }, ... ], - "navigation_text" (string) (default: ''): Text of navigation in breadcrumb - "ellipsis_label" (string) (default: ''): Label of the ellipsis, e.g. "Click to expand" - "ellipsis_text" (string) (default: '...'): Text of the ellipsis - "icon_file_path" (string) (default: ''): URL to icons file - "icon_size" (string) (default: '2xs'): Size of the icon between segments - "extra_classes" (string) (default: '') - "extra_attributes" (array) (default: []): format: [ { "name" (string) (default: ''), "value" (optional) (string) ... ] #} {# Internal properties #} {% set _breadcrumb_size = links|length %} {% set _links = links|default([]) %} {% set _icon_file_path = icon_file_path|default('') %} {% set _icon_size = icon_size|default('2xs') %} {% set _navigation_text = navigation_text|default('') %} {% set _ellipsis_label = ellipsis_label|default('') %} {% set _ellipsis_text = ellipsis_text|default('…') %} {% set _extra_attributes = '' %} {% set _breadcrumb_segment_class = 'ecl-breadcrumb-standardised__segment' %} {% set _min_items_left = min_items_left|default(1) %} {% set _min_items_right = min_items_right|default(2) %} {% set _nav_attributes = [ { name: 'aria-label', value: _navigation_text }, { name: 'data-ecl-breadcrumb-standardised', value: 'true' }] %} {% set _breadcrumb_icon = { icon: { name: 'corner-arrow', size: _icon_size, transform: 'rotate-90', path: _icon_file_path, }, extra_classes: 'ecl-breadcrumb-standardised__icon', extra_attributes: [{ name: 'role', value: 'presentation' }] } %} {% set _css_class = 'ecl-breadcrumb-standardised' %} {# Internal logic - Process properties #} {% if _breadcrumb_size > (_min_items_left + _min_items_right) %} {% set _nav_attributes = _nav_attributes|merge([{ name: 'data-ecl-auto-init', value: 'BreadcrumbStandardised' }]) %} {% endif %} {% if extra_classes is defined and extra_classes is not empty %} {% set _css_class = _css_class ~ ' ' ~ extra_classes %} {% endif %} {% if extra_attributes is defined and extra_attributes is not empty and extra_attributes is iterable %} {% set extra_attributes = extra_attributes|merge(_nav_attributes) %} {% else %} {% set extra_attributes = _nav_attributes %} {% endif %} {% for attr in extra_attributes %} {% if attr.value is defined %} {% set _extra_attributes = _extra_attributes ~ ' ' ~ attr.name ~ '="' ~ attr.value|e('html_attr') ~ '"' %} {% else %} {% set _extra_attributes = _extra_attributes ~ ' ' ~ attr.name %} {% endif %} {% endfor %} {# Print the result #} {% endspaceless %}