Skip to content

Commit

Permalink
#30057: Disabled renditions for old media gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
sivaschenko committed Sep 17, 2020
1 parent 24cec36 commit 2773046
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/code/Magento/MediaGalleryRenditions/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class Config
{
private const TABLE_CORE_CONFIG_DATA = 'core_config_data';
private const XML_PATH_MEDIA_GALLERY_ENABLED = 'system/media_gallery/enabled';
private const XML_PATH_ENABLED = 'system/media_gallery_renditions/enabled';
private const XML_PATH_MEDIA_GALLERY_RENDITIONS_WIDTH_PATH = 'system/media_gallery_renditions/width';
private const XML_PATH_MEDIA_GALLERY_RENDITIONS_HEIGHT_PATH = 'system/media_gallery_renditions/height';
Expand Down Expand Up @@ -49,6 +50,16 @@ public function __construct(
*
* @return bool
*/
public function isMediaGalleryEnabled(): bool
{
return $this->scopeConfig->isSetFlag(self::XML_PATH_MEDIA_GALLERY_ENABLED);
}

/**
* Should the renditions be inserted in the content instead of original image
*
* @return bool
*/
public function isEnabled(): bool
{
return $this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function beforeExecute(
$storeId
];

if (!$this->config->isEnabled()) {
if (!$this->config->isEnabled() || !$this->config->isMediaGalleryEnabled()) {
return $arguments;
}

Expand Down

0 comments on commit 2773046

Please sign in to comment.