Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SaveButton.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 ($canModify) {
47  $data = [
48  'label' => __('Save Customer'),
49  'class' => 'save primary',
50  'data_attribute' => [
51  'mage-init' => ['button' => ['event' => 'save']],
52  'form-role' => 'save',
53  ],
54  'sort_order' => 90,
55  ];
56  }
57  return $data;
58  }
59 }
__()
Definition: __.php:13
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, AccountManagementInterface $customerAccountManagement)
Definition: SaveButton.php:29