1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Customer\Block\Adminhtml\Edit;
- use Magento\Customer\Api\AccountManagementInterface;
- use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
- /**
- * Class SaveAndContinueButton
- */
- class SaveAndContinueButton extends GenericButton implements ButtonProviderInterface
- {
- /**
- * @var AccountManagementInterface
- */
- protected $customerAccountManagement;
- /**
- * Constructor
- *
- * @param \Magento\Backend\Block\Widget\Context $context
- * @param \Magento\Framework\Registry $registry
- * @param AccountManagementInterface $customerAccountManagement
- */
- public function __construct(
- \Magento\Backend\Block\Widget\Context $context,
- \Magento\Framework\Registry $registry,
- AccountManagementInterface $customerAccountManagement
- ) {
- parent::__construct($context, $registry);
- $this->customerAccountManagement = $customerAccountManagement;
- }
- /**
- * @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;
- }
- }
|