当前位置: 首页>>代码示例>>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;未经允许,请勿转载。