ExportXml.php 844 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Newsletter\Controller\Adminhtml\Subscriber;
  8. use Magento\Framework\App\ResponseInterface;
  9. use Magento\Framework\App\Filesystem\DirectoryList;
  10. class ExportXml extends \Magento\Newsletter\Controller\Adminhtml\Subscriber
  11. {
  12. /**
  13. * Export subscribers grid to XML format
  14. *
  15. * @return ResponseInterface
  16. */
  17. public function execute()
  18. {
  19. $this->_view->loadLayout();
  20. $fileName = 'subscribers.xml';
  21. $content = $this->_view->getLayout()->getChildBlock('adminhtml.newslettrer.subscriber.grid', 'grid.export');
  22. return $this->_fileFactory->create(
  23. $fileName,
  24. $content->getExcelFile($fileName),
  25. DirectoryList::VAR_DIR
  26. );
  27. }
  28. }