本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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 [];
}
示例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();
}
示例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;
}
}