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
Ui
Component
Listing
Column
BlockActions.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Cms\Ui\Component\Listing\Column
;
7
8
use
Magento\Framework\UrlInterface
;
9
use
Magento\Framework\View\Element\UiComponent\ContextInterface
;
10
use
Magento\Framework\View\Element\UiComponentFactory
;
11
use
Magento\Ui\Component\Listing\Columns\Column
;
12
use
Magento\Framework\App\ObjectManager
;
13
use
Magento\Framework\Escaper
;
14
18
class
BlockActions
extends
Column
19
{
23
const
URL_PATH_EDIT
=
'cms/block/edit'
;
24
const
URL_PATH_DELETE
=
'cms/block/delete'
;
25
const
URL_PATH_DETAILS
=
'cms/block/details'
;
26
30
protected
$urlBuilder
;
31
35
private
$escaper;
36
46
public
function
__construct
(
47
ContextInterface
$context
,
48
UiComponentFactory
$uiComponentFactory
,
49
UrlInterface
$urlBuilder
,
50
array
$components
= [],
51
array
$data
= []
52
) {
53
$this->urlBuilder =
$urlBuilder
;
54
parent::__construct(
$context
,
$uiComponentFactory
,
$components
,
$data
);
55
}
56
60
public
function
prepareDataSource
(array $dataSource)
61
{
62
if
(isset($dataSource[
'data'
][
'items'
])) {
63
foreach
($dataSource[
'data'
][
'items'
] as &
$item
) {
64
if
(isset(
$item
[
'block_id'
])) {
65
$title
= $this->getEscaper()->escapeHtml(
$item
[
'title'
]);
66
$item
[$this->
getData
(
'name'
)] = [
67
'edit'
=> [
68
'href'
=> $this->urlBuilder->getUrl(
69
static::URL_PATH_EDIT,
70
[
71
'block_id'
=>
$item
[
'block_id'
]
72
]
73
),
74
'label'
=>
__
(
'Edit'
)
75
],
76
'delete'
=> [
77
'href'
=> $this->urlBuilder->getUrl(
78
static::URL_PATH_DELETE,
79
[
80
'block_id'
=>
$item
[
'block_id'
]
81
]
82
),
83
'label'
=>
__
(
'Delete'
),
84
'confirm'
=> [
85
'title'
=>
__
(
'Delete %1'
,
$title
),
86
'message'
=>
__
(
'Are you sure you want to delete a %1 record?'
,
$title
)
87
],
88
'post'
=> true
89
]
90
];
91
}
92
}
93
}
94
95
return
$dataSource;
96
}
97
104
private
function
getEscaper()
105
{
106
if
(!$this->escaper) {
107
$this->escaper =
ObjectManager::getInstance
()->get(Escaper::class);
108
}
109
return
$this->escaper;
110
}
111
}
Magento\Framework\View\Element\UiComponentFactory
Definition:
UiComponentFactory.php:29
$title
$title
Definition:
default.phtml:14
Magento\Cms\Ui\Component\Listing\Column
Definition:
BlockActions.php:6
Magento\Ui\Component\Listing\Columns\Column\$uiComponentFactory
$uiComponentFactory
Definition:
Column.php:33
Magento\Framework\App\ObjectManager\getInstance
static getInstance()
Definition:
ObjectManager.php:33
Magento\Framework\View\Element\UiComponent\ContextInterface
Definition:
ContextInterface.php:17
Magento\Ui\Component\AbstractComponent\getData
getData($key='', $index=null)
Definition:
AbstractComponent.php:264
__
__()
Definition:
__.php:13
$item
$item
Definition:
partial_invoice.php:27
Magento\Framework\Escaper
Definition:
Escaper.php:15
Magento\Framework\App\ObjectManager
Definition:
ConfigCache.php:8
Magento\Framework\UrlInterface
Definition:
UrlInterface.php:12
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Cms\Ui\Component\Listing\Column\BlockActions\URL_PATH_DETAILS
const URL_PATH_DETAILS
Definition:
BlockActions.php:25
Magento\Cms\Ui\Component\Listing\Column\BlockActions\__construct
__construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, UrlInterface $urlBuilder, array $components=[], array $data=[])
Definition:
BlockActions.php:46
Magento\Ui\Component\AbstractComponent\$context
$context
Definition:
AbstractComponent.php:31
Magento\Cms\Ui\Component\Listing\Column\BlockActions\URL_PATH_EDIT
const URL_PATH_EDIT
Definition:
BlockActions.php:23
Magento\Ui\Component\Listing\Columns\Column
Definition:
Column.php:17
Magento\Cms\Ui\Component\Listing\Column\BlockActions\prepareDataSource
prepareDataSource(array $dataSource)
Definition:
BlockActions.php:60
Magento\Ui\Component\AbstractComponent\$components
$components
Definition:
AbstractComponent.php:36
Magento\Cms\Ui\Component\Listing\Column\BlockActions
Definition:
BlockActions.php:18
Magento\Cms\Ui\Component\Listing\Column\BlockActions\$urlBuilder
$urlBuilder
Definition:
BlockActions.php:30
Magento\Cms\Ui\Component\Listing\Column\BlockActions\URL_PATH_DELETE
const URL_PATH_DELETE
Definition:
BlockActions.php:24