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-url-rewrite
Block
Cms
Page
Edit.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\UrlRewrite\Block\Cms\Page
;
7
11
class
Edit
extends
\Magento\UrlRewrite\Block\Edit
12
{
16
protected
$_pageFactory
;
17
25
public
function
__construct
(
26
\
Magento
\Backend\Block\Widget\
Context
$context,
27
\
Magento
\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory,
28
\
Magento
\Backend\Helper\Data $adminhtmlData,
29
\
Magento
\Cms\Model\PageFactory $pageFactory,
30
array
$data
= []
31
) {
32
$this->_pageFactory = $pageFactory;
33
parent::__construct($context, $rewriteFactory, $adminhtmlData,
$data
);
34
}
35
41
protected
function
_prepareLayoutFeatures
()
42
{
43
if
($this->
_getUrlRewrite
()->getId()) {
44
$this->_headerText =
__
(
'Edit URL Rewrite for CMS page'
);
45
}
else
{
46
$this->_headerText =
__
(
'Add URL Rewrite for CMS page'
);
47
}
48
49
if
($this->_getCmsPage()->getId()) {
50
$this->_addCmsPageLinkBlock();
51
$this->
_addEditFormBlock
();
52
if
($this->
_getUrlRewrite
()->getId() ===
null
) {
53
$this->
_updateBackButtonLink
($this->_adminhtmlData->getUrl(
'adminhtml/*/edit'
) .
'cms_page'
);
54
}
55
}
else
{
56
$this->
_addUrlRewriteSelectorBlock
();
57
$this->_addCmsPageGridBlock();
58
}
59
}
60
66
private
function
_getCmsPage()
67
{
68
if
(!$this->
hasData
(
'cms_page'
)) {
69
$this->setCmsPage($this->_pageFactory->create());
70
}
71
return
$this->getCmsPage();
72
}
73
79
private
function
_addCmsPageLinkBlock()
80
{
81
$this->
addChild
(
82
'cms_page_link'
,
83
\
Magento
\UrlRewrite\Block\Link::class,
84
[
85
'item_url'
=> $this->_adminhtmlData->getUrl(
'adminhtml/*/*'
) .
'cms_page'
,
86
'item_name'
=> $this->getCmsPage()->getTitle(),
87
'label'
=>
__
(
'CMS page:'
)
88
]
89
);
90
}
91
97
private
function
_addCmsPageGridBlock()
98
{
99
$this->
addChild
(
'cms_pages_grid'
, \
Magento
\UrlRewrite\Block\Cms\Page\Grid::class);
100
}
101
107
protected
function
_createEditFormBlock
()
108
{
109
return
$this->
getLayout
()->createBlock(
110
\
Magento
\UrlRewrite\Block\Cms\Page\
Edit
\Form::class,
111
''
,
112
[
'data'
=> [
'cms_page'
=> $this->_getCmsPage(),
'url_rewrite'
=> $this->
_getUrlRewrite
()]]
113
);
114
}
115
}
Magento\UrlRewrite\Block\Edit
Definition:
Edit.php:11
Magento\UrlRewrite\Block\Edit\_addEditFormBlock
_addEditFormBlock()
Definition:
Edit.php:98
Magento\Framework\View\Element\AbstractBlock\addChild
addChild($alias, $block, $data=[])
Definition:
AbstractBlock.php:385
__
__()
Definition:
__.php:13
Magento\Framework\DataObject\hasData
hasData($key='')
Definition:
DataObject.php:231
Magento\UrlRewrite\Block\Edit\_addUrlRewriteSelectorBlock
_addUrlRewriteSelectorBlock()
Definition:
Edit.php:222
Magento\UrlRewrite\Block\Cms\Page\Edit\__construct
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, \Magento\Backend\Helper\Data $adminhtmlData, \Magento\Cms\Model\PageFactory $pageFactory, array $data=[])
Definition:
Edit.php:25
Magento\UrlRewrite\Block\Edit\_updateBackButtonLink
_updateBackButtonLink($link)
Definition:
Edit.php:152
Magento\UrlRewrite\Block\Cms\Page\Edit\_prepareLayoutFeatures
_prepareLayoutFeatures()
Definition:
Edit.php:41
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Framework\View\Element\AbstractBlock\getLayout
getLayout()
Definition:
AbstractBlock.php:295
Magento\UrlRewrite\Block\Cms\Page\Edit\$_pageFactory
$_pageFactory
Definition:
Edit.php:16
Magento
Magento\UrlRewrite\Block\Cms\Page
Context
Definition:
ClassesForConstructorIntegrity.php:33
Magento\UrlRewrite\Block\Cms\Page\Edit\_createEditFormBlock
_createEditFormBlock()
Definition:
Edit.php:107
Magento\UrlRewrite\Block\Cms\Page\Edit
Definition:
Edit.php:11
Magento\UrlRewrite\Block\Edit\_getUrlRewrite
_getUrlRewrite()
Definition:
Edit.php:270