diff --git a/app/code/Magento/Catalog/Block/Product/ImageBuilder.php b/app/code/Magento/Catalog/Block/Product/ImageBuilder.php deleted file mode 100644 index ad62031976ee1..0000000000000 --- a/app/code/Magento/Catalog/Block/Product/ImageBuilder.php +++ /dev/null @@ -1,163 +0,0 @@ -helperFactory = $helperFactory; - $this->imageFactory = $imageFactory; - } - - /** - * Set product - * - * @param Product $product - * @return $this - */ - public function setProduct(Product $product) - { - $this->product = $product; - return $this; - } - - /** - * Set image ID - * - * @param string $imageId - * @return $this - */ - public function setImageId($imageId) - { - $this->imageId = $imageId; - return $this; - } - - /** - * Set custom attributes - * - * @param array $attributes - * @return $this - */ - public function setAttributes(array $attributes) - { - $this->attributes = $attributes; - return $this; - } - - /** - * Retrieve image custom attributes for HTML element - * - * @return string - */ - protected function getCustomAttributes() - { - $result = []; - foreach ($this->attributes as $name => $value) { - $result[] = $name . '="' . $value . '"'; - } - return !empty($result) ? implode(' ', $result) : ''; - } - - /** - * Calculate image ratio - * - * @param \Magento\Catalog\Helper\Image $helper - * @return float|int - */ - protected function getRatio(\Magento\Catalog\Helper\Image $helper) - { - $width = $helper->getWidth(); - $height = $helper->getHeight(); - if ($width && $height) { - return $height / $width; - } - return 1; - } - - /** - * Create image block - * - * @return \Magento\Catalog\Block\Product\Image - */ - public function create() - { - /** @var \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface $simpleOption */ - $simpleOption = $this->product->getCustomOption('simple_product'); - - if ($simpleOption !== null) { - $optionProduct = $simpleOption->getProduct(); - $this->setProduct($optionProduct); - } - - /** @var \Magento\Catalog\Helper\Image $helper */ - $helper = $this->helperFactory->create() - ->init($this->product, $this->imageId); - - $template = $helper->getFrame() - ? 'Magento_Catalog::product/image.phtml' - : 'Magento_Catalog::product/image_with_borders.phtml'; - - try { - $imagesize = $helper->getResizedImageInfo(); - } catch (NotLoadInfoImageException $exception) { - $imagesize = [$helper->getWidth(), $helper->getHeight()]; - } - - $data = [ - 'data' => [ - 'template' => $template, - 'image_url' => $helper->getUrl(), - 'width' => $helper->getWidth(), - 'height' => $helper->getHeight(), - 'label' => $helper->getLabel(), - 'ratio' => $this->getRatio($helper), - 'custom_attributes' => $this->getCustomAttributes(), - 'resized_image_width' => $imagesize[0], - 'resized_image_height' => $imagesize[1], - 'product_id' => $this->product->getId() - ], - ]; - - return $this->imageFactory->create($data); - } -} diff --git a/app/code/Magento/Customer/etc/acl.xml b/app/code/Magento/Customer/etc/acl.xml index a500608e1cdf5..8c3151a2e0acc 100644 --- a/app/code/Magento/Customer/etc/acl.xml +++ b/app/code/Magento/Customer/etc/acl.xml @@ -12,6 +12,7 @@ + @@ -19,10 +20,7 @@ - - - - +