Skip to content

Commit 2773046

Browse files
committed
#30057: Disabled renditions for old media gallery
1 parent 24cec36 commit 2773046

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

app/code/Magento/MediaGalleryRenditions/Model/Config.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
class Config
1919
{
2020
private const TABLE_CORE_CONFIG_DATA = 'core_config_data';
21+
private const XML_PATH_MEDIA_GALLERY_ENABLED = 'system/media_gallery/enabled';
2122
private const XML_PATH_ENABLED = 'system/media_gallery_renditions/enabled';
2223
private const XML_PATH_MEDIA_GALLERY_RENDITIONS_WIDTH_PATH = 'system/media_gallery_renditions/width';
2324
private const XML_PATH_MEDIA_GALLERY_RENDITIONS_HEIGHT_PATH = 'system/media_gallery_renditions/height';
@@ -49,6 +50,16 @@ public function __construct(
4950
*
5051
* @return bool
5152
*/
53+
public function isMediaGalleryEnabled(): bool
54+
{
55+
return $this->scopeConfig->isSetFlag(self::XML_PATH_MEDIA_GALLERY_ENABLED);
56+
}
57+
58+
/**
59+
* Should the renditions be inserted in the content instead of original image
60+
*
61+
* @return bool
62+
*/
5263
public function isEnabled(): bool
5364
{
5465
return $this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED);

app/code/Magento/MediaGalleryRenditions/Plugin/SetRenditionPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function beforeExecute(
9191
$storeId
9292
];
9393

94-
if (!$this->config->isEnabled()) {
94+
if (!$this->config->isEnabled() || !$this->config->isMediaGalleryEnabled()) {
9595
return $arguments;
9696
}
9797

0 commit comments

Comments
 (0)