/**
  * @return array
  */
 protected function getSampleColumn()
 {
     $sampleContainer['arguments']['data']['config'] = ['componentType' => Container::NAME, 'formElement' => Container::NAME, 'component' => 'Magento_Ui/js/form/components/group', 'label' => __('File'), 'dataScope' => ''];
     $sampleType['arguments']['data']['config'] = ['formElement' => Form\Element\Select::NAME, 'componentType' => Form\Field::NAME, 'component' => 'Magento_Downloadable/js/components/upload-type-handler', 'dataType' => Form\Element\DataType\Text::NAME, 'dataScope' => 'type', 'options' => $this->typeUpload->toOptionArray(), 'typeFile' => 'sample_file', 'typeUrl' => 'sample_url'];
     $sampleUrl['arguments']['data']['config'] = ['formElement' => Form\Element\Input::NAME, 'componentType' => Form\Field::NAME, 'dataType' => Form\Element\DataType\Text::NAME, 'dataScope' => 'sample_url', 'placeholder' => 'URL', 'validation' => ['required-entry' => true, 'validate-url' => true]];
     $sampleUploader['arguments']['data']['config'] = ['formElement' => 'fileUploader', 'componentType' => 'fileUploader', 'component' => 'Magento_Downloadable/js/components/file-uploader', 'elementTmpl' => 'Magento_Downloadable/components/file-uploader', 'fileInputName' => 'samples', 'uploaderConfig' => ['url' => $this->urlBuilder->addSessionParam()->getUrl('adminhtml/downloadable_file/upload', ['type' => 'samples', '_secure' => true])], 'dataScope' => 'file', 'validation' => ['required-entry' => true]];
     return $this->arrayManager->set('children', $sampleContainer, ['sample_type' => $sampleType, 'sample_url' => $sampleUrl, 'sample_file' => $sampleUploader]);
 }
Exemple #2
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;
 }
Exemple #3
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;
 }
 /**
  * Returns Dynamic rows records configuration
  *
  * @return array
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function getRows()
 {
     return ['record' => ['arguments' => ['data' => ['config' => ['componentType' => Container::NAME, 'isTemplate' => true, 'is_collection' => true, 'component' => 'Magento_Ui/js/dynamic-rows/record', 'dataScope' => '']]], 'children' => ['thumbnail_image_container' => $this->getColumn('thumbnail_image', __('Image'), ['fit' => true, 'formElement' => 'fileUploader', 'componentType' => 'fileUploader', 'component' => 'Magento_ConfigurableProduct/js/components/file-uploader', 'elementTmpl' => 'Magento_ConfigurableProduct/components/file-uploader', 'fileInputName' => 'image', 'isMultipleFiles' => false, 'links' => ['thumbnailUrl' => '${$.provider}:${$.parentScope}.thumbnail_image', 'thumbnail' => '${$.provider}:${$.parentScope}.thumbnail', 'smallImage' => '${$.provider}:${$.parentScope}.small_image'], 'uploaderConfig' => ['url' => $this->urlBuilder->addSessionParam()->getUrl('catalog/product_gallery/upload')], 'dataScope' => 'image'], ['elementTmpl' => 'ui/dynamic-rows/cells/thumbnail', 'fit' => true, 'sortOrder' => 0]), 'name_container' => $this->getColumn('name', __('Name'), [], ['dataScope' => 'product_link']), 'sku_container' => $this->getColumn('sku', __('SKU')), 'price_container' => $this->getColumn('price', __('Price'), ['imports' => ['addbefore' => '${$.provider}:${$.parentScope}.price_currency'], 'validation' => ['validate-zero-or-greater' => true]], ['dataScope' => 'price_string']), 'quantity_container' => $this->getColumn('quantity', __('Quantity'), ['dataScope' => 'qty'], ['dataScope' => 'qty']), 'price_weight' => $this->getColumn('weight', __('Weight')), 'status' => ['arguments' => ['data' => ['config' => ['componentType' => 'text', 'component' => 'Magento_Ui/js/form/element/abstract', 'template' => 'Magento_ConfigurableProduct/components/cell-status', 'label' => __('Status'), 'dataScope' => 'status']]]], 'attributes' => ['arguments' => ['data' => ['config' => ['componentType' => Form\Field::NAME, 'formElement' => Form\Element\Input::NAME, 'component' => 'Magento_Ui/js/form/element/text', 'elementTmpl' => 'ui/dynamic-rows/cells/text', 'dataType' => Form\Element\DataType\Text::NAME, 'label' => __('Attributes')]]]], 'actionsList' => ['arguments' => ['data' => ['config' => ['additionalClasses' => 'data-grid-actions-cell', 'componentType' => 'text', 'component' => 'Magento_Ui/js/form/element/abstract', 'template' => 'Magento_ConfigurableProduct/components/actions-list', 'label' => __('Actions'), 'fit' => true, 'dataScope' => 'status']]]]]]];
 }