Feed.php 848 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Copyright © 2017 Ihor Vansach (ihor@magefan.com). All rights reserved.
  4. * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
  5. *
  6. * Glory to Ukraine! Glory to the heroes!
  7. */
  8. namespace Magefan\Blog\Controller\Rss;
  9. /**
  10. * Blog rss feed view
  11. */
  12. class Feed extends \Magefan\Blog\App\Action\Action
  13. {
  14. /**
  15. * View blog rss feed action
  16. *
  17. * @return \Magento\Framework\Controller\ResultInterface
  18. */
  19. public function execute()
  20. {
  21. if (!$this->moduleEnabled()) {
  22. return $this->_forwardNoroute();
  23. }
  24. $this->_view->loadLayout();
  25. $this->getResponse()
  26. ->setHeader('Content-type', 'text/xml; charset=UTF-8')
  27. ->setBody(
  28. $this->_view->getLayout()->getBlock('blog.rss.feed')->toHtml()
  29. );
  30. }
  31. }