16 class Edit extends \Magento\Backend\Block\Widget\Form\Container
57 \
Magento\Customer\Helper\View $viewHelper,
63 $this->_viewHelper = $viewHelper;
64 parent::__construct($context,
$data);
72 $this->_objectId =
'id';
73 $this->_controller =
'adminhtml';
74 $this->_blockGroup =
'Magento_Customer';
78 if (
$customerId && $this->_authorization->isAllowed(
'Magento_Sales::create')) {
79 $this->buttonList->add(
82 'label' =>
__(
'Create Order'),
92 $this->buttonList->update('save
', 'label
', __('Save Customer
')); 93 $this->buttonList->update('delete', 'label
', __('Delete Customer
')); 95 if ($customerId && $this->customerAccountManagement->isReadonly($customerId)) { 96 $this->buttonList->remove('save
'); 97 $this->buttonList->remove('reset
'); 100 if (!$customerId || $this->customerAccountManagement->isReadonly($customerId)) { 101 $this->buttonList->remove('delete'); 105 $url = $this->getUrl('customer/index/resetPassword
', ['customer_id
' => $customerId]); 106 $this->buttonList->add( 109 'label
' => __('Reset Password
'), 110 'onclick
' => 'setLocation(\
'' .
$url .
'\')
', 111 'class' => 'reset reset-password
' 118 $url = $this->getUrl('customer/customer/invalidateToken
', ['customer_id
' => $customerId]); 119 $deleteConfirmMsg = __("Are you sure you want to revoke the customer's tokens?
"); 120 $this->buttonList->add( 123 'label' => __('Force Sign-In'), 124 'onclick' => 'deleteConfirm(\'' . $this->escapeJs($this->escapeHtml($deleteConfirmMsg)) . 125 '\', \'' . $url . '\')', 126 'class' => 'invalidate-token' 138 public function getCreateOrderUrl() 140 return $this->getUrl('sales/order_create/start', ['customer_id' => $this->getCustomerId()]); 148 public function getCustomerId() 150 $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); 159 public function getHeaderText() 161 $customerId = $this->getCustomerId(); 163 $customerData = $this->customerRepository->getById($customerId); 164 return $this->escapeHtml($this->_viewHelper->getCustomerName($customerData)); 166 return __('New Customer'); 175 public function getFormHtml() 177 $html = parent::getFormHtml(); 178 $html .= $this->getLayout()->createBlock( 179 \Magento\Catalog\Block\Adminhtml\Product\Composite\Configure::class 189 public function getValidationUrl() 191 return $this->getUrl('customer/*/validate', ['_current' => true]); 199 protected function _prepareLayout() 201 $customerId = $this->getCustomerId(); 202 if (!$customerId || !$this->customerAccountManagement->isReadonly($customerId)) { 203 $this->buttonList->add( 206 'label' => __('Save and Continue Edit'), 208 'data_attribute' => [ 210 'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'], 218 return parent::_prepareLayout(); 226 protected function _getSaveAndContinueUrl() 228 return $this->getUrl( 229 'customer/index/save', 230 ['_current' => true, 'back' => 'edit', 'tab' => '{{tab_id}}']
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, AccountManagementInterface $customerAccountManagement, CustomerRepositoryInterface $customerRepository, \Magento\Customer\Helper\View $viewHelper, array $data=[])
$customerAccountManagement