예제 #1
0
파일: Edit.php 프로젝트: aiesh/magento2
 /**
  * @return void
  */
 protected function _construct()
 {
     $this->_objectId = 'id';
     $this->_controller = 'adminhtml';
     $this->_blockGroup = 'Magento_Customer';
     $customerId = $this->getCustomerId();
     if ($customerId && $this->_authorization->isAllowed('Magento_Sales::create')) {
         $this->buttonList->add('order', array('label' => __('Create Order'), 'onclick' => 'setLocation(\'' . $this->getCreateOrderUrl() . '\')', 'class' => 'add'), 0);
     }
     parent::_construct();
     $this->buttonList->update('save', 'label', __('Save Customer'));
     $this->buttonList->update('delete', 'label', __('Delete Customer'));
     if ($customerId && !$this->_customerAccountService->canModify($customerId)) {
         $this->buttonList->remove('save');
         $this->buttonList->remove('reset');
     }
     if (!$customerId || !$this->_customerAccountService->canDelete($customerId)) {
         $this->buttonList->remove('delete');
     }
     if ($customerId) {
         $url = $this->getUrl('customer/index/resetPassword', array('customer_id' => $customerId));
         $this->buttonList->add('reset_password', array('label' => __('Reset Password'), 'onclick' => 'setLocation(\'' . $url . '\')', 'class' => 'reset reset-password'), 0);
     }
     if ($customerId) {
         $url = $this->getUrl('customer/customer/invalidateToken', array('customer_id' => $customerId));
         $deleteConfirmMsg = __("Are you sure you want to revoke the customer\\'s tokens?");
         $this->buttonList->add('invalidate_token', array('label' => __('Force Sign-In'), 'onclick' => 'deleteConfirm(\'' . $deleteConfirmMsg . '\', \'' . $url . '\')', 'class' => 'invalidate-token'), 10);
     }
 }