Skip to content

Commit

Permalink
feat: support shopware <6.4.18
Browse files Browse the repository at this point in the history
  • Loading branch information
tinect authored Mar 28, 2024
1 parent 79154d7 commit 6d1dcdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"thumbnail"
],
"description": "Automatically calculate the best thumbnail size. This means you don't have to worry about the \"sizes\" attribute for the images. Additionally, you gain a score.",
"version": "1.1.0",
"version": "1.1.1",
"type": "shopware-platform-plugin",
"license": "mit",
"authors": [
Expand All @@ -16,7 +16,7 @@
}
],
"require": {
"shopware/core": "~6.4.10"
"shopware/core": ">=6.4.10||<6.4.18"
},
"extra": {
"shopware-plugin-class": "Frosh\\LazySizes\\FroshLazySizes",
Expand Down
31 changes: 3 additions & 28 deletions src/Resources/views/storefront/utilities/thumbnail.html.twig
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
{% sw_extends "@Storefront/storefront/utilities/thumbnail.html.twig" %}

{% block thumbnail_utility %}{% apply spaceless %}
{% if lazysizes is not defined %}
{% set lazysizesThroughCss = null %}
{% for item in [sectionClasses, blockClasses] %}
{% if item is defined %}
{# Yes, item is an array!
Therefore we need to combine any entry and convert it back to array #}
{% set item = item|join(' ')|split(' ') %}

{% if 'no-lazysizes' in item %}
{% set lazysizesThroughCss = false %}
{% elseif 'lazysizes' in item %}
{% set lazysizesThroughCss = true %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}

{% set lazysizes = lazysizes ?? lazysizesThroughCss ?? true %}

{% if lazysizes %}
{% sw_include '@FroshLazySizes/storefront/utilities/thumbnail-lazysize.html.twig' %}
{% else %}
{{ parent() }}
{% endif %}
{% endapply%}{% endblock %}
{% apply spaceless %}
{% sw_include '@FroshLazySizes/storefront/utilities/thumbnail-lazysize.html.twig' %}
{% endapply %}

0 comments on commit 6d1dcdd

Please sign in to comment.