Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ExportSearchCsv.php
Go to the documentation of this file.
1 <?php
7 
13 
15 {
19  protected $fileFactory;
20 
25  public function __construct(
26  Context $context,
28  ) {
29  $this->fileFactory = $fileFactory;
30  parent::__construct($context);
31  }
32 
39  public function execute()
40  {
42  $resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
43  $content = $resultLayout->getLayout()->getChildBlock('adminhtml.report.search.grid', 'grid.export');
44  return $this->fileFactory->create('search.csv', $content->getCsvFile(), DirectoryList::VAR_DIR);
45  }
46 }
__construct(Context $context, FileFactory $fileFactory)