當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AccountManagementInterface::isReadonly方法代碼示例

本文整理匯總了PHP中Magento\Customer\Api\AccountManagementInterface::isReadonly方法的典型用法代碼示例。如果您正苦於以下問題:PHP AccountManagementInterface::isReadonly方法的具體用法?PHP AccountManagementInterface::isReadonly怎麽用?PHP AccountManagementInterface::isReadonly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Customer\Api\AccountManagementInterface的用法示例。


在下文中一共展示了AccountManagementInterface::isReadonly方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getButtonData

 /**
  * @return array
  */
 public function getButtonData()
 {
     $customerId = $this->getCustomerId();
     $canModify = !$customerId || !$this->customerAccountManagement->isReadonly($this->getCustomerId());
     $data = [];
     if ($canModify) {
         $data = ['label' => __('Save and Continue Edit'), 'class' => 'save', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit']]], 'sort_order' => 80];
     }
     return $data;
 }
開發者ID:tingyeeh,項目名稱:magento2,代碼行數:13,代碼來源:SaveAndContinueButton.php

示例2: getButtonData

 /**
  * @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];
     }
     return $data;
 }
開發者ID:tingyeeh,項目名稱:magento2,代碼行數:13,代碼來源:DeleteButton.php

示例3: getButtonData

 /**
  * @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', 'on_click' => 'deleteConfirm(\'' . __('Are you sure you want to do this?') . '\', \'' . $this->getDeleteUrl() . '\')', 'sort_order' => 20];
     }
     return $data;
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:13,代碼來源:DeleteButton.php

示例4: _addEditCustomerFormFields

 /**
  * Edit/View Existing Customer form fields
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @return string[] Values to set on the form
  */
 protected function _addEditCustomerFormFields($fieldset)
 {
     $fieldset->getForm()->getElement('created_in')->setDisabled('disabled');
     $fieldset->getForm()->getElement('website_id')->setDisabled('disabled');
     $customerData = $this->_getCustomerDataObject();
     if ($customerData->getId() && $this->_accountManagement->isReadonly($customerData->getId())) {
         return [];
     }
     // Prepare customer confirmation control (only for existing customers)
     $confirmationStatus = $this->_accountManagement->getConfirmationStatus($customerData->getId());
     $confirmationKey = $customerData->getConfirmation();
     if ($confirmationStatus != AccountManagementInterface::ACCOUNT_CONFIRMED) {
         $confirmationAttr = $this->_customerMetadata->getAttributeMetadata('confirmation');
         if (!$confirmationKey) {
             $confirmationKey = $this->_getRandomConfirmationKey();
         }
         $element = $fieldset->addField('confirmation', 'select', ['name' => 'confirmation', 'label' => __($confirmationAttr->getFrontendLabel())]);
         $element->setEntityAttribute($confirmationAttr);
         $element->setValues(['' => 'Confirmed', $confirmationKey => 'Not confirmed']);
         // Prepare send welcome email checkbox if customer is not confirmed
         // no need to add it, if website ID is empty
         if ($customerData->getConfirmation() && $customerData->getWebsiteId()) {
             $fieldset->addField('sendemail', 'checkbox', ['name' => 'sendemail', 'label' => __('Send Welcome Email after Confirmation')]);
             return ['sendemail' => '1'];
         }
     }
     return [];
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:34,代碼來源:Account.php

示例5: _prepareLayout

 /**
  * Prepare the layout.
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     $customerId = $this->getCustomerId();
     if (!$customerId || !$this->customerAccountManagement->isReadonly($customerId)) {
         $this->buttonList->add('save_and_continue', ['label' => __('Save and Continue Edit'), 'class' => 'save', 'data_attribute' => ['mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']]]], 10);
     }
     return parent::_prepareLayout();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:13,代碼來源:Edit.php

示例6: isReadonly

 /**
  * Check block is readonly.
  *
  * @return bool
  */
 public function isReadonly()
 {
     $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID);
     if (empty($customerId)) {
         return false;
     }
     try {
         return $this->_customerAccountManagement->isReadonly($customerId);
     } catch (NoSuchEntityException $e) {
         return false;
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:17,代碼來源:Addresses.php


注:本文中的Magento\Customer\Api\AccountManagementInterface::isReadonly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。