Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-cms
Controller
Index
Index.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Cms\Controller\Index
;
7
8
use
Magento\Framework\App\Action\HttpPostActionInterface
;
9
use
Magento\Framework\App\Action\HttpGetActionInterface
;
10
use
Magento\Framework\App\Action\Context
;
11
use
Magento\Framework\App\Config\ScopeConfigInterface
;
12
use
Magento\Framework\App\ObjectManager
;
13
use
Magento\Framework\App\ResponseInterface
;
14
use
Magento\Framework\Controller\ResultInterface
;
15
use
Magento\Framework\Controller\Result\Forward
;
16
use Magento\Framework\Controller\Result\ForwardFactory;
17
use
Magento\Framework\View\Result\Page
as ResultPage;
18
use
Magento\Cms\Helper\Page
;
19
use
Magento\Store\Model\ScopeInterface
;
20
use
Magento\Framework\App\Action\Action
;
21
25
class
Index
extends
Action
implements
HttpGetActionInterface
,
HttpPostActionInterface
26
{
30
protected
$resultForwardFactory
;
31
35
private
$scopeConfig;
36
40
private
$page;
41
50
public
function
__construct
(
51
Context
$context,
52
ForwardFactory
$resultForwardFactory
,
53
ScopeConfigInterface
$scopeConfig =
null
,
54
Page
$page =
null
55
) {
56
$this->resultForwardFactory =
$resultForwardFactory
;
57
$this->scopeConfig = $scopeConfig ? :
ObjectManager::getInstance
()->get(ScopeConfigInterface::class);
58
$this->page = $page ? :
ObjectManager::getInstance
()->get(Page::class);
59
parent::__construct($context);
60
}
61
71
public
function
execute
($coreRoute =
null
)
72
{
73
$pageId = $this->scopeConfig->getValue(
Page::XML_PATH_HOME_PAGE
,
ScopeInterface::SCOPE_STORE
);
74
$resultPage = $this->page->prepareResultPage($this, $pageId);
75
if
(!$resultPage) {
77
$resultForward = $this->resultForwardFactory->create();
78
$resultForward->forward(
'defaultIndex'
);
79
return
$resultForward;
80
}
81
return
$resultPage;
82
}
83
}
Magento\Store\Model\ScopeInterface\SCOPE_STORE
const SCOPE_STORE
Definition:
ScopeInterface.php:21
Magento\Framework\App\ObjectManager\getInstance
static getInstance()
Definition:
ObjectManager.php:33
Magento\Framework\App\Action\HttpGetActionInterface
Definition:
HttpGetActionInterface.php:16
Magento\Framework\View\Result\Page
Definition:
Page.php:30
Magento\Cms\Controller\Index\Index
Definition:
Index.php:25
Magento\Framework\Controller\ResultInterface
Definition:
ResultInterface.php:19
Magento\Cms\Helper\Page\XML_PATH_HOME_PAGE
const XML_PATH_HOME_PAGE
Definition:
Page.php:31
Magento\Framework\App\ObjectManager
Definition:
ConfigCache.php:8
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Framework\Controller\Result\Forward
Definition:
Forward.php:13
Magento\Store\Model\ScopeInterface
Definition:
ScopeInterface.php:12
Magento\Cms\Controller\Index
Definition:
DefaultIndex.php:9
Magento\Cms\Controller\Index\Index\__construct
__construct(Context $context, ForwardFactory $resultForwardFactory, ScopeConfigInterface $scopeConfig=null, Page $page=null)
Definition:
Index.php:50
Magento\Cms\Controller\Index\Index\$resultForwardFactory
$resultForwardFactory
Definition:
Index.php:30
Magento\Framework\App\Action\HttpPostActionInterface
Definition:
HttpPostActionInterface.php:16
Magento\Cms\Helper\Page
Definition:
Page.php:16
Magento\Framework\App\Action\Context
Definition:
Context.php:24
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
Magento\Framework\App\ResponseInterface
Definition:
ResponseInterface.php:14
Magento\Framework\App\Action\Action
Definition:
Action.php:25