diff --git a/vendor/magento/module-catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php b/vendor/magento/module-catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php index b06edc43cd71d..468e50b2b0706 100644 --- a/vendor/magento/module-catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php +++ b/vendor/magento/module-catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php @@ -13,6 +13,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery; +use Magento\Catalog\Helper\Image; use Magento\Framework\App\ObjectManager; use Magento\Backend\Block\Media\Uploader; use Magento\Framework\Json\Helper\Data as JsonHelper; @@ -45,7 +46,7 @@ class Content extends \Magento\Backend\Block\Widget protected $_jsonEncoder; /** - * @var \Magento\Catalog\Helper\Image + * @var Image */ private $imageHelper; @@ -67,6 +68,7 @@ class Content extends \Magento\Backend\Block\Widget * @param ImageUploadConfigDataProvider $imageUploadConfigDataProvider * @param Database $fileStorageDatabase * @param JsonHelper|null $jsonHelper + * @param Image|null $imageHelper */ public function __construct( \Magento\Backend\Block\Template\Context $context, @@ -75,7 +77,8 @@ public function __construct( array $data = [], ImageUploadConfigDataProvider $imageUploadConfigDataProvider = null, Database $fileStorageDatabase = null, - ?JsonHelper $jsonHelper = null + ?JsonHelper $jsonHelper = null, + ?Image $imageHelper = null ) { $this->_jsonEncoder = $jsonEncoder; $this->_mediaConfig = $mediaConfig; @@ -85,6 +88,7 @@ public function __construct( ?: ObjectManager::getInstance()->get(ImageUploadConfigDataProvider::class); $this->fileStorageDatabase = $fileStorageDatabase ?: ObjectManager::getInstance()->get(Database::class); + $this->imageHelper = $imageHelper ?: ObjectManager::getInstance()->get(Image::class); } /** @@ -191,7 +195,7 @@ public function getImagesJson() $fileHandler = $mediaDir->stat($this->_mediaConfig->getMediaPath($image['file'])); $image['size'] = $fileHandler['size']; } catch (FileSystemException $e) { - $image['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('small_image'); + $image['url'] = $this->imageHelper->getDefaultPlaceholderUrl('small_image'); $image['size'] = 0; $this->_logger->warning($e); } @@ -304,17 +308,14 @@ public function getImageTypesJson() } /** - * Returns image helper object. + * Flag if gallery content editing is enabled. * - * @return \Magento\Catalog\Helper\Image - * @deprecated 101.0.3 + * Is enabled by default, exposed to interceptors to add custom logic + * + * @return bool */ - private function getImageHelper() + public function isEditEnabled() : bool { - if ($this->imageHelper === null) { - $this->imageHelper = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Catalog\Helper\Image::class); - } - return $this->imageHelper; + return true; } } diff --git a/vendor/magento/module-catalog/i18n/en_US.csv b/vendor/magento/module-catalog/i18n/en_US.csv index 81e059adb3bb0..7460622cd9a8e 100644 --- a/vendor/magento/module-catalog/i18n/en_US.csv +++ b/vendor/magento/module-catalog/i18n/en_US.csv @@ -820,4 +820,4 @@ Details,Details "The linked product SKU is invalid. Verify the data and try again.","The linked product SKU is invalid. Verify the data and try again." "The linked products data is invalid. Verify the data and try again.","The linked products data is invalid. Verify the data and try again." "The url has invalid characters. Please correct and try again.","The url has invalid characters. Please correct and try again." - +"Restricted admin is allowed to perform actions with images or videos, only when the admin has rights to all websites which the product is assigned to.","Restricted admin is allowed to perform actions with images or videos, only when the admin has rights to all websites which the product is assigned to." diff --git a/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml b/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml index 12cbcd7031e98..110e7fe565948 100644 --- a/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml +++ b/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml @@ -9,17 +9,29 @@ /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ $elementName = $block->getElement()->getName() . '[images]'; $formName = $block->getFormName(); +$isEditEnabled = $block->isEditEnabled(); + /** @var \Magento\Framework\Json\Helper\Data $jsonHelper */ $jsonHelper = $block->getData('jsonHelper'); + +$message = 'Restricted admin is allowed to perform actions with images or videos, ' . + 'only when the admin has rights to all websites which the product is assigned to.'; ?> + +