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-customer
Block
Adminhtml
Edit
DeleteButton.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Customer\Block\Adminhtml\Edit
;
7
8
use
Magento\Customer\Api\AccountManagementInterface
;
9
use
Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface
;
10
15
class
DeleteButton
extends
GenericButton
implements
ButtonProviderInterface
16
{
20
protected
$customerAccountManagement
;
21
29
public
function
__construct
(
30
\
Magento
\Backend\Block\Widget\
Context
$context,
31
\
Magento
\Framework\Registry
$registry
,
32
AccountManagementInterface
$customerAccountManagement
33
) {
34
parent::__construct($context,
$registry
);
35
$this->customerAccountManagement =
$customerAccountManagement
;
36
}
37
41
public
function
getButtonData
()
42
{
43
$customerId
= $this->
getCustomerId
();
44
$canModify =
$customerId
&& !$this->customerAccountManagement->isReadonly($this->
getCustomerId
());
45
$data
= [];
46
if
(
$customerId
&& $canModify) {
47
$data
= [
48
'label'
=>
__
(
'Delete Customer'
),
49
'class'
=>
'delete'
,
50
'id'
=>
'customer-edit-delete-button'
,
51
'data_attribute'
=> [
52
'url'
=> $this->
getDeleteUrl
()
53
],
54
'on_click'
=>
''
,
55
'sort_order'
=> 20,
56
];
57
}
58
return
$data
;
59
}
60
64
public
function
getDeleteUrl
()
65
{
66
return
$this->
getUrl
(
'*/*/delete'
, [
'id'
=> $this->
getCustomerId
()]);
67
}
68
}
Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface
Definition:
ButtonProviderInterface.php:11
Magento\Customer\Block\Adminhtml\Edit\DeleteButton\getDeleteUrl
getDeleteUrl()
Definition:
DeleteButton.php:64
Magento\Customer\Block\Adminhtml\Edit\GenericButton\getCustomerId
getCustomerId()
Definition:
GenericButton.php:49
Magento\Customer\Block\Adminhtml\Edit
__
__()
Definition:
__.php:13
Magento\Customer\Block\Adminhtml\Edit\GenericButton\getUrl
getUrl($route='', $params=[])
Definition:
GenericButton.php:61
Magento\Customer\Block\Adminhtml\Edit\DeleteButton\getButtonData
getButtonData()
Definition:
DeleteButton.php:41
Magento\Customer\Block\Adminhtml\Edit\DeleteButton\__construct
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, AccountManagementInterface $customerAccountManagement)
Definition:
DeleteButton.php:29
Magento\Customer\Block\Adminhtml\Edit\DeleteButton\$customerAccountManagement
$customerAccountManagement
Definition:
DeleteButton.php:20
Magento\Customer\Block\Adminhtml\Edit\GenericButton\$registry
$registry
Definition:
GenericButton.php:28
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$customerId
$customerId
Definition:
quote_with_customer.php:16
Magento\Customer\Block\Adminhtml\Edit\GenericButton
Definition:
GenericButton.php:14
Magento
Magento\Customer\Block\Adminhtml\Edit\DeleteButton
Definition:
DeleteButton.php:15
Context
Definition:
ClassesForConstructorIntegrity.php:33
Magento\Customer\Api\AccountManagementInterface
Definition:
AccountManagementInterface.php:17