Exemplo n.º 1
0
 /**
  * Processes image as new.
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param array $image
  * @return array
  */
 protected function processNewImage($product, array &$image)
 {
     $data = [];
     $data['value'] = $image['file'];
     $data['attribute_id'] = $this->getAttribute()->getAttributeId();
     if (!empty($image['media_type'])) {
         $data['media_type'] = $image['media_type'];
     }
     $image['value_id'] = $this->resourceModel->insertGallery($data);
     $this->resourceModel->bindValueToEntity($image['value_id'], $product->getData($this->metadata->getLinkField()));
     return $data;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function insertGallery($data)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'insertGallery');
     if (!$pluginInfo) {
         return parent::insertGallery($data);
     } else {
         return $this->___callPlugins('insertGallery', func_get_args(), $pluginInfo);
     }
 }