Exemplo n.º 1
0
 /**
  * @param \Magento\Framework\Data\Form\Element\Factory $factoryElement
  * @param \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection
  * @param \Magento\Framework\Escaper $escaper
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  * @param \Magento\Backend\Model\UrlFactory $backendUrlFactory
  * @param \Magento\Catalog\Helper\Data $catalogData
  * @param \Magento\Framework\File\Size $fileConfig
  * @param array $data
  */
 public function __construct(\Magento\Framework\Data\Form\Element\Factory $factoryElement, \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Framework\Escaper $escaper, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Backend\Model\UrlFactory $backendUrlFactory, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\File\Size $fileConfig, array $data = array())
 {
     parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
     $this->_assetRepo = $assetRepo;
     $this->_url = $backendUrlFactory->create();
     $this->_catalogHelperData = $catalogData;
     $this->_fileConfig = $fileConfig;
     $this->_maxFileSize = $this->_getFileMaxSize();
 }
Exemplo n.º 2
0
 /**
  * Determine the admin path
  *
  * @return string
  */
 private function extractAdminPath()
 {
     $backendApp = $this->backendAppList->getCurrentApp();
     $cookiePath = null;
     $baseUrl = parse_url($this->backendUrlFactory->create()->getBaseUrl(), PHP_URL_PATH);
     if (!$backendApp) {
         $cookiePath = $baseUrl . $this->_frontNameResolver->getFrontName();
         return $cookiePath;
     }
     //In case of application authenticating through the admin login, the script name should be removed
     //from the path, because application has own script.
     $baseUrl = \Magento\Framework\App\Request\Http::getUrlNoScript($baseUrl);
     $cookiePath = $baseUrl . $backendApp->getCookiePath();
     return $cookiePath;
 }
Exemplo n.º 3
0
 /**
  * Retrieve config json
  *
  * @return string
  */
 public function getConfigJson()
 {
     $url = $this->_urlFactory->create()->addSessionParam()->getUrl('adminhtml/downloadable_file/upload', ['type' => 'samples', '_secure' => true]);
     $this->getConfig()->setUrl($url);
     $this->getConfig()->setParams(['form_key' => $this->getFormKey()]);
     $this->getConfig()->setFileField('samples');
     $this->getConfig()->setFilters(['all' => ['label' => __('All Files'), 'files' => ['*.*']]]);
     $this->getConfig()->setReplaceBrowseWithRemove(true);
     $this->getConfig()->setWidth('32');
     $this->getConfig()->setHideUploadButton(true);
     return $this->_jsonEncoder->encode($this->getConfig()->getData());
 }
Exemplo n.º 4
0
 /**
  * Retrieve Upload URL
  *
  * @param string $type
  * @return string
  */
 public function getUploadUrl($type)
 {
     return $this->_urlFactory->create()->addSessionParam()->getUrl('adminhtml/downloadable_file/upload', ['type' => $type, '_secure' => true]);
 }