Example #1
0
 /**
  * Add Link File info into $linkData
  *
  * @param array $linkData
  * @param LinkInterface $link
  * @return array
  */
 protected function addLinkFile(array $linkData, LinkInterface $link)
 {
     $linkFile = $link->getLinkFile();
     if ($linkFile) {
         $file = $this->downloadableFile->getFilePath($this->linkModel->getBasePath(), $linkFile);
         if ($this->downloadableFile->ensureFileInFilesystem($file)) {
             $linkData['file'][0] = ['file' => $linkFile, 'name' => $this->downloadableFile->getFileFromPathFile($linkFile), 'size' => $this->downloadableFile->getFileSize($file), 'status' => 'old', 'url' => $this->urlBuilder->addSessionParam()->getUrl('adminhtml/downloadable_product_edit/link', ['id' => $link->getId(), 'type' => 'link', '_secure' => true])];
         }
     }
     return $linkData;
 }
Example #2
0
 /**
  * Add Sample File info into $sampleData
  *
  * @param array $sampleData
  * @param SampleInterface $sample
  * @return array
  */
 protected function addSampleFile(array $sampleData, SampleInterface $sample)
 {
     $sampleFile = $sample->getSampleFile();
     if ($sampleFile) {
         $file = $this->downloadableFile->getFilePath($this->sampleModel->getBasePath(), $sampleFile);
         if ($this->downloadableFile->ensureFileInFilesystem($file)) {
             $sampleData['file'][0] = ['file' => $sampleFile, 'name' => $this->downloadableFile->getFileFromPathFile($sampleFile), 'size' => $this->downloadableFile->getFileSize($file), 'status' => 'old', 'url' => $this->urlBuilder->addSessionParam()->getUrl('adminhtml/downloadable_product_edit/sample', ['id' => $sample->getId(), '_secure' => true])];
         }
     }
     return $sampleData;
 }