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
UnlockButton.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Customer\Block\Adminhtml\Edit
;
7
8
use
Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface
;
9
use
Magento\Customer\Model\CustomerRegistry
;
10
14
class
UnlockButton
extends
GenericButton
implements
ButtonProviderInterface
15
{
19
protected
$customerRegistry
;
20
28
public
function
__construct
(
29
\
Magento
\Backend\Block\Widget\
Context
$context,
30
\
Magento
\Framework\Registry
$registry
,
31
CustomerRegistry
$customerRegistry
32
) {
33
parent::__construct($context,
$registry
);
34
$this->customerRegistry =
$customerRegistry
;
35
}
36
42
public
function
getButtonData
()
43
{
44
$customerId
= $this->
getCustomerId
();
45
$data
= [];
46
if
(
$customerId
) {
47
$customer
= $this->customerRegistry->retrieve(
$customerId
);
48
if
(
$customer
->isCustomerLocked()) {
49
$data
= [
50
'label'
=>
__
(
'Unlock'
),
51
'class'
=>
'unlock unlock-customer'
,
52
'on_click'
=> sprintf(
"location.href = '%s';"
, $this->
getUnlockUrl
()),
53
'sort_order'
=> 50,
54
];
55
}
56
}
57
return
$data
;
58
}
59
65
protected
function
getUnlockUrl
()
66
{
67
return
$this->
getUrl
(
'customer/locks/unlock'
, [
'customer_id'
=> $this->
getCustomerId
()]);
68
}
69
}
Magento\Customer\Block\Adminhtml\Edit\UnlockButton\$customerRegistry
$customerRegistry
Definition:
UnlockButton.php:19
Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface
Definition:
ButtonProviderInterface.php:11
$customer
$customer
Definition:
customers.php:11
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\UnlockButton\getButtonData
getButtonData()
Definition:
UnlockButton.php:42
Magento\Customer\Block\Adminhtml\Edit\GenericButton\getUrl
getUrl($route='', $params=[])
Definition:
GenericButton.php:61
Magento\Customer\Block\Adminhtml\Edit\GenericButton\$registry
$registry
Definition:
GenericButton.php:28
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Customer\Block\Adminhtml\Edit\UnlockButton\__construct
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, CustomerRegistry $customerRegistry)
Definition:
UnlockButton.php:28
$customerId
$customerId
Definition:
quote_with_customer.php:16
Magento\Customer\Block\Adminhtml\Edit\GenericButton
Definition:
GenericButton.php:14
Magento
Magento\Customer\Model\CustomerRegistry
Definition:
CustomerRegistry.php:17
Context
Definition:
ClassesForConstructorIntegrity.php:33
Magento\Customer\Block\Adminhtml\Edit\UnlockButton\getUnlockUrl
getUnlockUrl()
Definition:
UnlockButton.php:65
Magento\Customer\Block\Adminhtml\Edit\UnlockButton
Definition:
UnlockButton.php:14