/** * {@inheritdoc} */ public function toOptionArray() { $options = []; foreach ($this->_exportConfig->getFileFormats() as $formatName => $formatConfig) { $options[] = ['value' => $formatName, 'label' => __($formatConfig['label'])]; } return $options; }
/** * Get writer object. * * @return \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter * @throws \Magento\Framework\Exception\LocalizedException */ protected function _getWriter() { if (!$this->_writer) { $fileFormats = $this->_exportConfig->getFileFormats(); if (isset($fileFormats[$this->getFileFormat()])) { try { $this->_writer = $this->_exportAdapterFac->create($fileFormats[$this->getFileFormat()]['model']); } catch (\Exception $e) { $this->_logger->critical($e); throw new \Magento\Framework\Exception\LocalizedException(__('Please enter a correct entity model.')); } if (!$this->_writer instanceof \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter) { throw new \Magento\Framework\Exception\LocalizedException(__('The adapter object must be an instance of %1.', 'Magento\\ImportExport\\Model\\Export\\Adapter\\AbstractAdapter')); } } else { throw new \Magento\Framework\Exception\LocalizedException(__('Please correct the file format.')); } } return $this->_writer; }