From 4bf7de93a4eb7ada9ce2bd4e72ea304a72ea4575 Mon Sep 17 00:00:00 2001 From: tinect Date: Wed, 12 May 2021 15:38:09 +0200 Subject: [PATCH] fix: cleanup code and restrict to sw6.4 --- .github/workflows/pack-plugin.yml | 2 +- CHANGELOG_de-DE.md | 4 ++ CHANGELOG_en-GB.md | 4 ++ composer.json | 4 +- src/Resources/config/config.xml | 20 -------- src/Resources/config/services.xml | 1 - .../product/card/box-standard.html.twig | 46 ------------------- .../component/product/card/box.html.twig | 25 ---------- .../cms-element-image-gallery.html.twig | 14 ------ .../storefront/utilities/thumbnail.html.twig | 2 +- src/Service/ThumbnailServiceDecorator.php | 29 ++++-------- 11 files changed, 20 insertions(+), 131 deletions(-) delete mode 100644 src/Resources/views/storefront/component/product/card/box-standard.html.twig delete mode 100644 src/Resources/views/storefront/component/product/card/box.html.twig delete mode 100644 src/Resources/views/storefront/element/cms-element-image-gallery.html.twig diff --git a/.github/workflows/pack-plugin.yml b/.github/workflows/pack-plugin.yml index 4dd3cc0..8488446 100644 --- a/.github/workflows/pack-plugin.yml +++ b/.github/workflows/pack-plugin.yml @@ -14,7 +14,7 @@ env: jobs: pack: runs-on: ubuntu-latest - container: ghcr.io/friendsofshopware/platform-plugin-dev:v6.3.4 + container: ghcr.io/friendsofshopware/platform-plugin-dev:v6.4.0 steps: - name: Checkout uses: actions/checkout@v2.3.1 diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index 1f13add..23b68ea 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,7 @@ +# 1.0.16 + +* FEATURE Support für SW6.4 + # 1.0.15 * FEATURE Support für SW6.4 diff --git a/CHANGELOG_en-GB.md b/CHANGELOG_en-GB.md index 27729bf..d6e1ecb 100644 --- a/CHANGELOG_en-GB.md +++ b/CHANGELOG_en-GB.md @@ -1,3 +1,7 @@ +# 1.0.16 + +* FEATURE Better support for SW6.4 + # 1.0.15 * FEATURE Add support for SW6.4 diff --git a/composer.json b/composer.json index 4749d98..a15ed45 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "thumbnail" ], "description": "This plugins allows you to use variable thumbnails, without having them on storage.", - "version": "1.0.15", + "version": "1.0.16", "type": "shopware-platform-plugin", "license": "mit", "authors": [ @@ -21,7 +21,7 @@ } ], "require": { - "shopware/core": "~6.3|~6.4" + "shopware/core": "~6.4" }, "extra": { "shopware-plugin-class": "Frosh\\ThumbnailProcessor\\FroshPlatformThumbnailProcessor", diff --git a/src/Resources/config/config.xml b/src/Resources/config/config.xml index 16b20c2..18dcaf5 100644 --- a/src/Resources/config/config.xml +++ b/src/Resources/config/config.xml @@ -33,26 +33,6 @@ - - FixListingThumbnailSizes - - 1 - - There are problems with thumbnail-sizes in storefront. - This can help you delivering better matching sizes to the visitor. - - - - - FixDetailGalleryThumbnailSizes - - 1 - - There are problems with thumbnail-sizes in the gallery of the product page. - This can help you delivering better matching sizes to the visitor. - - - DefaultContainerMaxSize diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 3813d95..8cc48de 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -12,7 +12,6 @@ - %shopware.filesystem.public.url% - {# fallback if display mode is not set #} - {% set displayMode = displayMode ?: 'standard' %} - - {# set display mode 'cover' for box-image with standard display mode #} - {% if layout == 'image' and displayMode == 'standard' %} - {% set displayMode = 'cover' %} - {% endif %} - - - {% if cover.url %} - {% set attributes = { - 'class': 'product-image is-'~displayMode, - 'alt': (cover.translated.alt ?: name), - 'title': (cover.translated.title ?: name) - } %} - - {% if displayMode == 'cover' or displayMode == 'contain' %} - {% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %} - {% endif %} - - {% sw_thumbnails 'product-image-thumbnails' with { - media: cover, - sizes: sizes - } %} - {% else %} -
- {% sw_icon 'placeholder' style { - 'size': 'fluid' - } %} -
- {% endif %} -
- - {% endif %} -{% endblock %} diff --git a/src/Resources/views/storefront/component/product/card/box.html.twig b/src/Resources/views/storefront/component/product/card/box.html.twig deleted file mode 100644 index f103817..0000000 --- a/src/Resources/views/storefront/component/product/card/box.html.twig +++ /dev/null @@ -1,25 +0,0 @@ -{% sw_extends '@Storefront/storefront/component/product/card/box.html.twig' %} - -{% block component_product_box_include %} - {% if shopware.config.FroshPlatformThumbnailProcessor.config.FixListingThumbnailSizes %} - - {# Default is 200px #} - {% set sizes = { - 'default': '200px' - } %} - - {# We overwrite definition for layout image #} - {% if layout == 'image' %} - {% set sizes = { - 'xs': '332px', - 'sm': '295px', - 'md': '332px', - 'lg': '319px', - 'xl': '274px', - } %} - {% endif %} - - {% endif %} - - {{ parent() }} -{% endblock %} diff --git a/src/Resources/views/storefront/element/cms-element-image-gallery.html.twig b/src/Resources/views/storefront/element/cms-element-image-gallery.html.twig deleted file mode 100644 index c233311..0000000 --- a/src/Resources/views/storefront/element/cms-element-image-gallery.html.twig +++ /dev/null @@ -1,14 +0,0 @@ -{% sw_extends '@Storefront/storefront/element/cms-element-image-gallery.html.twig' %} - -{% block element_image_gallery_inner_item %} - {% if shopware.config.FroshPlatformThumbnailProcessor.config.FixDetailGalleryThumbnailSizes %} - {% set sizes = { - 'xs': '225px', - 'sm': '430px', - 'md': '430px', - 'lg': '430px' - } %} - {% endif %} - - {{ parent() }} -{% endblock %} diff --git a/src/Resources/views/storefront/utilities/thumbnail.html.twig b/src/Resources/views/storefront/utilities/thumbnail.html.twig index 387fb1d..9e254ab 100644 --- a/src/Resources/views/storefront/utilities/thumbnail.html.twig +++ b/src/Resources/views/storefront/utilities/thumbnail.html.twig @@ -24,7 +24,7 @@ {% set container = 100 %} {% set sizes = sizes|merge({ 'xl': (container / columns)|round(0, 'ceil') ~'vw'}) %} {% else %} - {% set defaultContainerMaxSize = shopware.config.FroshPlatformThumbnailProcessor.config.DefaultContainerMaxSize %} + {% set defaultContainerMaxSize = config('FroshPlatformThumbnailProcessor.config.DefaultContainerMaxSize') %} {% if defaultContainerMaxSize is defined %} {% set container = defaultContainerMaxSize %} {% else %} diff --git a/src/Service/ThumbnailServiceDecorator.php b/src/Service/ThumbnailServiceDecorator.php index b830eba..b81e8db 100644 --- a/src/Service/ThumbnailServiceDecorator.php +++ b/src/Service/ThumbnailServiceDecorator.php @@ -38,28 +38,15 @@ public function __construct( FilesystemInterface $fileSystemPublic, FilesystemInterface $fileSystemPrivate, UrlGeneratorInterface $urlGenerator, - EntityRepositoryInterface $mediaFolderRepository, - string $version + EntityRepositoryInterface $mediaFolderRepository ) { - - if (version_compare($version, '6.4.0.0', '<')) { - parent::__construct( - $mediaRepository, - $thumbnailRepository, - $fileSystemPublic, - $fileSystemPrivate, - $urlGenerator, - $mediaFolderRepository - ); - } else { - parent::__construct( - $thumbnailRepository, - $fileSystemPublic, - $fileSystemPrivate, - $urlGenerator, - $mediaFolderRepository - ); - } + parent::__construct( + $thumbnailRepository, + $fileSystemPublic, + $fileSystemPrivate, + $urlGenerator, + $mediaFolderRepository + ); $this->mediaRepository = $mediaRepository; $this->thumbnailRepository = $thumbnailRepository;