![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-customer/Block/Adminhtml/Edit/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Customer\Block\Adminhtml\Edit; use Magento\Customer\Api\AccountManagementInterface; use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; /** * Class DeleteButton * * @package Magento\Customer\Block\Adminhtml\Edit */ class DeleteButton extends GenericButton implements ButtonProviderInterface { /** * @var AccountManagementInterface */ protected $customerAccountManagement; /** * Constructor * * @param \Magento\Backend\Block\Widget\Context $context * @param \Magento\Framework\Registry $registry * @param AccountManagementInterface $customerAccountManagement */ public function __construct( \Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, AccountManagementInterface $customerAccountManagement ) { parent::__construct($context, $registry); $this->customerAccountManagement = $customerAccountManagement; } /** * Get button data. * * @return array */ public function getButtonData() { $customerId = $this->getCustomerId(); $canModify = $customerId && !$this->customerAccountManagement->isReadonly($this->getCustomerId()); $data = []; if ($customerId && $canModify) { $data = [ 'label' => __('Delete Customer'), 'class' => 'delete', 'id' => 'customer-edit-delete-button', 'data_attribute' => [ 'url' => $this->getDeleteUrl() ], 'on_click' => '', 'sort_order' => 20, 'aclResource' => 'Magento_Customer::delete', ]; } return $data; } /** * Get delete url. * * @return string */ public function getDeleteUrl() { return $this->getUrl('*/*/delete', ['id' => $this->getCustomerId()]); } }