{% spaceless %} {% set keyPrefix = keyPrefix ?? '' %} {% macro sourceLink(key, source, isTopLevel, elementType) %} {% from _self import sourceInnerHtml %} {{ tag('a', { data: { key: key, 'has-thumbs': (source.hasThumbs ?? false) ? true : false, 'has-structure': (source.structureId ?? false) ? true : false, 'default-sort': (source.defaultSort ?? false) ? (source.defaultSort is iterable ? source.defaultSort|join(':') : source.defaultSort) : false, 'sort-options': isTopLevel ? craft.app.elementIndexes.getSourceSortOptions(elementType, key) |map(o => [o.label, o.attribute ?? o.orderBy]) |json_encode : false, sites: (source.sites ?? false) ? source.sites|join(',') : false, 'override-status': (source.criteria.status ?? false) ? true : false, 'default-source-path': (source.defaultSourcePath ?? false) ? source.defaultSourcePath|json_encode : false, }|merge(source.data ?? {}), html: sourceInnerHtml(source) }) }} {% endmacro %} {% macro sourceInnerHtml(source) %} {% if source.status is defined %} {% elseif source.icon is defined %} {{ (svg(source.icon, sanitize=true, namespace=true) ?: "")|raw }} {% elseif source.iconMask is defined %} {{ (svg(source.iconMask, sanitize=true, namespace=true) ?: "")|raw }} {% endif %} {{ source.label }} {% if source.badgeCount is defined %} {{ source.badgeCount|number(decimals=0) }} {% endif %} {% endmacro %} {% from _self import sourceLink %}