{% block element_subcategories %}
{% set config = element.fieldConfig.elements %}
{% if element.data.elements|length >0 %}
<div class="cms-element-subcategories" style="width: 100%">
<div class="subcategories-text">
{% if element.config.cattitle.value %}
<div class="title">{{element.config.cattitle.value|raw}}</div>
{% endif %}
{% if element.config.description.value %}
<div class="description">{{element.config.description.value|raw}}</div>
{% endif %}
</div>
<ul class="row">
{% for subcategory in element.data.elements %}
{% if context.salesChannel.id =='3213ffda35704f1a84f5e7376117a2a2' and subcategory.customFields.custom_category_usa_disable %}
{% else %}
<li class="col-md-2 col-4 {% if subcategory.type=='folder' %}d-none{% endif %}">
{% if subcategory.type=='page' %}
<a class="link" href="{{ seoUrl('frontend.navigation.page', {navigationId: subcategory.id}) }}">
{% elseif subcategory.type=='link' and subcategory.externalLink %}
<a class="link" href="{{ subcategory.externalLink }}">
{% elseif subcategory.type=='link' and subcategory.linkType=='category' %}
<a class="link" href="{{ seoUrl('frontend.navigation.page', {navigationId: subcategory.internalLink}) }}">
{% else %}
<div class="link">
{% endif %}
<div class="cat-img">
{% if subcategory.media %}
{% sw_thumbnails 'moorl-listing-item-image-thumbnails' with {
media: subcategory.media,
attributes: {
'itemprop': 'image',
'alt': title,
'class': "is-#{config.displayMode.value}",
'style': imageCss|join(';'),
'title': ''
}
} %}
{% else %}
<div class="product-image-placeholder">
{% sw_icon 'placeholder' style {
'size': 'fluid'
} %}
</div>
{% endif %}
</div>
<div class="cat-title">
{% set name = subcategory.translated.name %}
{% for translation in subcategory.translations %}
{% if translation.languageId==context.salesChannel.languageId and translation.name !='' %}
{% set name = translation.name %}
{% endif %}
{% endfor %}
{{name}}
</div>
{% if subcategory.type=='page' or (subcategory.type=='link' and subcategory.externalLink) or (subcategory.type=='link' and subcategory.linkType=='category') %}
</a>
{% else %}
</div>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
<div align="center">
<a id="loadmorecats" class="btn btn-primary mb-5" href="#">{{"LdsSubCategories.readmore"|trans}}</a>
</div>
{% endif %}
{% endblock %}