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->isAuthRequired() && !$this->auth()) {
37  return;
38  }
39 
40  if (!$provider->isAllowed()) {
41  throw new NotFoundException(__('Page not found.'));
42  }
43 
45  $rss = $this->rssFactory->create();
46  $rss->setDataProvider($provider);
47 
48  $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
49  $this->getResponse()->setBody($rss->createRssXml());
50  }
51 }
__()
Definition: __.php:13
$type
Definition: item.phtml:13