Skip to content

Commit 8d1b726

Browse files
author
Evgeniy Miskov
committed
MAGETWO-33059: Refactor CMS module
1 parent 6773730 commit 8d1b726

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

app/code/Magento/Cms/Helper/Page.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ public function prepareResultPage(Action $action, $pageId = null)
167167
$this->_design->setDesignTheme($this->_page->getCustomTheme());
168168
}
169169
}
170-
$resultPage = $this->_setLayoutType($inRange);
170+
/** @var \Magento\Framework\View\Result\Page $resultPage */
171+
$resultPage = $this->resultPageFactory->create();
172+
$this->_setLayoutType($inRange, $resultPage);
171173
$resultPage->initLayout();
172174
$resultPage->addHandle('cms_page_view');
173175
$resultPage->addPageLayoutHandles(['id' => $this->_page->getIdentifier()]);
@@ -221,8 +223,6 @@ public function renderPage(Action $action, $pageId = null)
221223
* @param int $pageId
222224
* @param bool $renderLayout
223225
* @return bool
224-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
225-
* @SuppressWarnings(PHPMD.NPathComplexity)
226226
*/
227227
protected function _renderPage(Action $action, $pageId = null, $renderLayout = true)
228228
{
@@ -253,7 +253,9 @@ protected function _renderPage(Action $action, $pageId = null, $renderLayout = t
253253
$this->_design->setDesignTheme($this->_page->getCustomTheme());
254254
}
255255
}
256-
$resultPage = $this->_setLayoutType($inRange);
256+
/** @var \Magento\Framework\View\Result\Page $resultPage */
257+
$resultPage = $this->_view->getPage();
258+
$this->_setLayoutType($inRange, $resultPage);
257259
$resultPage->initLayout();
258260
$resultPage->addHandle('cms_page_view');
259261
$resultPage->addPageLayoutHandles(['id' => $this->_page->getIdentifier()]);
@@ -333,12 +335,11 @@ public function getPageUrl($pageId = null)
333335
* Set layout type
334336
*
335337
* @param bool $inRange
338+
* @param \Magento\Framework\View\Result\Page $resultPage
336339
* @return \Magento\Framework\View\Result\Page
337340
*/
338-
protected function _setLayoutType($inRange)
341+
protected function _setLayoutType($inRange, $resultPage)
339342
{
340-
/** @var \Magento\Framework\View\Result\Page $resultPage */
341-
$resultPage = $this->resultPageFactory->create();
342343
if ($this->_page->getPageLayout()) {
343344
if ($this->_page->getCustomPageLayout()
344345
&& $this->_page->getCustomPageLayout() != 'empty'
@@ -349,7 +350,6 @@ protected function _setLayoutType($inRange)
349350
$handle = $this->_page->getPageLayout();
350351
}
351352
$resultPage->getConfig()->setPageLayout($handle);
352-
return $resultPage;
353353
}
354354
return $resultPage;
355355
}

0 commit comments

Comments
 (0)