Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Index.php
Go to the documentation of this file.
1 <?php
8 
10 
16 {
23  public function execute()
24  {
25  if (!$this->scopeConfig->getValue('rss/config/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
26  throw new NotFoundException(__('Page not found.'));
27  }
28 
29  $type = $this->getRequest()->getParam('type');
30  try {
31  $provider = $this->rssManager->getProvider($type);
32  } catch (\InvalidArgumentException $e) {
33  throw new NotFoundException(__($e->getMessage()));
34  }
35 
36  if (!$provider->isAllowed()) {
37  throw new NotFoundException(__('Page not found.'));
38  }
39 
41  $rss = $this->rssFactory->create();
42  $rss->setDataProvider($provider);
43 
44  $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
45  $this->getResponse()->setBody($rss->createRssXml());
46  }
47 }
__()
Definition: __.php:13
$type
Definition: item.phtml:13