Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteButton.php
Go to the documentation of this file.
1 <?php
7 
10 
16 {
21 
29  public function __construct(
30  \Magento\Backend\Block\Widget\Context $context,
31  \Magento\Framework\Registry $registry,
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 }
__()
Definition: __.php:13
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, AccountManagementInterface $customerAccountManagement)