From 93dee85008c6407b14f8ebf841b22e2a38bc74a0 Mon Sep 17 00:00:00 2001 From: Peter Jaap Blaakmeer Date: Wed, 6 Jan 2021 15:45:10 +0100 Subject: [PATCH] Moved fetching a singleton to its own controller --- Controller/Direct/Page.php | 4 ---- Controller/Direct/Singleton.php | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Controller/Direct/Singleton.php diff --git a/Controller/Direct/Page.php b/Controller/Direct/Page.php index 3a2be5e..65f6df0 100644 --- a/Controller/Direct/Page.php +++ b/Controller/Direct/Page.php @@ -42,10 +42,6 @@ public function execute() $contentType = $this->getRequest() ->getParam('type'); - if ($uid === 'singleton') { - return $this->page->renderPageBySingleton($contentType); - } - return $this->page->renderPageByUid($uid, $contentType); } } diff --git a/Controller/Direct/Singleton.php b/Controller/Direct/Singleton.php new file mode 100644 index 0000000..2fc71d4 --- /dev/null +++ b/Controller/Direct/Singleton.php @@ -0,0 +1,37 @@ +page = $page; + } + + /** + * View CMS page action + * + * @return \Magento\Framework\Controller\ResultInterface + */ + public function execute() + { + $contentType = $this->getRequest() + ->getParam('type'); + + return $this->page->renderPageBySingleton($contentType); + } +}