1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- *
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Cms\Controller\Page;
- use Magento\Framework\App\Action\HttpPostActionInterface;
- use Magento\Framework\App\Action\HttpGetActionInterface;
- use Magento\Framework\App\Action\Action;
- /**
- * Custom page for storefront. Needs to be accessible by POST because of the store switching.
- */
- class View extends Action implements HttpGetActionInterface, HttpPostActionInterface
- {
- /**
- * @var \Magento\Framework\Controller\Result\ForwardFactory
- */
- protected $resultForwardFactory;
- /**
- * @param \Magento\Framework\App\Action\Context $context
- * @param \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory
- */
- public function __construct(
- \Magento\Framework\App\Action\Context $context,
- \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory
- ) {
- $this->resultForwardFactory = $resultForwardFactory;
- parent::__construct($context);
- }
- /**
- * View CMS page action
- *
- * @return \Magento\Framework\Controller\ResultInterface
- */
- public function execute()
- {
- $pageId = $this->getRequest()->getParam('page_id', $this->getRequest()->getParam('id', false));
- $resultPage = $this->_objectManager->get(\Magento\Cms\Helper\Page::class)->prepareResultPage($this, $pageId);
- if (!$resultPage) {
- $resultForward = $this->resultForwardFactory->create();
- return $resultForward->forward('noroute');
- }
- return $resultPage;
- }
- }
|