diff --git a/vendor/magento/module-contact/view/frontend/layout/contact_index_index.xml b/vendor/magento/module-contact/view/frontend/layout/contact_index_index.xml index 078c1a4ff562..9fb4fea6c773 100644 --- a/vendor/magento/module-contact/view/frontend/layout/contact_index_index.xml +++ b/vendor/magento/module-contact/view/frontend/layout/contact_index_index.xml @@ -12,6 +12,9 @@ + + Magento\Framework\View\Element\ButtonLockManager + diff --git a/vendor/magento/module-contact/view/frontend/templates/form.phtml b/vendor/magento/module-contact/view/frontend/templates/form.phtml index 99e61e8249da..1552897cb085 100644 --- a/vendor/magento/module-contact/view/frontend/templates/form.phtml +++ b/vendor/magento/module-contact/view/frontend/templates/form.phtml @@ -8,40 +8,47 @@ // phpcs:disable Generic.Files.LineLength.TooLong /** @var \Magento\Contact\Block\ContactForm $block */ +if (!$block->getButtonLockManager()) { + $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); + $block->setButtonLockManager( + $objectManager->get(\Magento\Framework\View\Element\ButtonLockManager::class) + ); +} +/** @var $escaper \Magento\Framework\Escaper */ /** @var \Magento\Contact\ViewModel\UserDataProvider $viewModel */ $viewModel = $block->getViewModel(); ?>
- escapeHtml(__('Write Us')) ?>
+ escapeHtml(__('Write Us')) ?>
- escapeHtml(__('Jot us a note and we’ll get back to you as quickly as possible.')) ?> + escapeHtml(__('Jot us a note and we’ll get back to you as quickly as possible.')) ?>
- +
- +
+ >escapeHtml($viewModel->getUserComment()) ?>
getChildHtml('form.additional.info') ?> @@ -80,8 +87,12 @@ $viewModel = $block->getViewModel();
-
diff --git a/vendor/magento/module-customer/ViewModel/CreateAccountButton.php b/vendor/magento/module-customer/ViewModel/CreateAccountButton.php deleted file mode 100644 index 8fa8718fe37e..000000000000 --- a/vendor/magento/module-customer/ViewModel/CreateAccountButton.php +++ /dev/null @@ -1,26 +0,0 @@ - Magento\Customer\Block\DataProviders\AddressAttributeData Magento\Customer\ViewModel\Address\RegionProvider - Magento\Customer\ViewModel\CreateAccountButton + Magento\Framework\View\Element\ButtonLockManager diff --git a/vendor/magento/module-customer/view/frontend/layout/customer_account_edit.xml b/vendor/magento/module-customer/view/frontend/layout/customer_account_edit.xml index e89aa5ab624d..3dd38d61aee0 100644 --- a/vendor/magento/module-customer/view/frontend/layout/customer_account_edit.xml +++ b/vendor/magento/module-customer/view/frontend/layout/customer_account_edit.xml @@ -21,6 +21,9 @@ + + Magento\Framework\View\Element\ButtonLockManager + diff --git a/vendor/magento/module-customer/view/frontend/layout/customer_account_forgotpassword.xml b/vendor/magento/module-customer/view/frontend/layout/customer_account_forgotpassword.xml index 7c8a6991e5a8..7fcf612de0c0 100644 --- a/vendor/magento/module-customer/view/frontend/layout/customer_account_forgotpassword.xml +++ b/vendor/magento/module-customer/view/frontend/layout/customer_account_forgotpassword.xml @@ -18,7 +18,7 @@ - Magento\Customer\ViewModel\ForgotPasswordButton + Magento\Framework\View\Element\ButtonLockManager diff --git a/vendor/magento/module-customer/view/frontend/layout/customer_account_login.xml b/vendor/magento/module-customer/view/frontend/layout/customer_account_login.xml index 8fb51eeb6650..90cd080cf2f6 100644 --- a/vendor/magento/module-customer/view/frontend/layout/customer_account_login.xml +++ b/vendor/magento/module-customer/view/frontend/layout/customer_account_login.xml @@ -16,7 +16,7 @@ - Magento\Customer\ViewModel\LoginButton + Magento\Framework\View\Element\ButtonLockManager diff --git a/vendor/magento/module-customer/view/frontend/templates/form/edit.phtml b/vendor/magento/module-customer/view/frontend/templates/form/edit.phtml index 6734e9ad30a4..0d99344589b9 100644 --- a/vendor/magento/module-customer/view/frontend/templates/form/edit.phtml +++ b/vendor/magento/module-customer/view/frontend/templates/form/edit.phtml @@ -7,17 +7,24 @@ use Magento\Customer\Block\Widget\Name; /** @var \Magento\Customer\Block\Form\Edit $block */ +if (!$block->getButtonLockManager()) { + $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); + $block->setButtonLockManager( + $objectManager->get(\Magento\Framework\View\Element\ButtonLockManager::class) + ); +} +/** @var $escaper \Magento\Framework\Escaper */ /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */ ?>
getBlockHtml('formkey') ?> - escapeHtml(__('Account Information')) ?>
+ escapeHtml(__('Account Information')) ?>
getLayout()->createBlock(Name::class)->setObject($block->getCustomer())->toHtml() ?> getLayout()->createBlock(\Magento\Customer\Block\Widget\Dob::class) ?> @@ -34,17 +41,17 @@ use Magento\Customer\Block\Widget\Name;
+ title="escapeHtmlAttr(__('Change Email')) ?>" class="checkbox" />
getChangePassword()): ?> checked="checked" class="checkbox" />
getChildHtml('fieldset_edit_info_additional') ?> @@ -52,21 +59,21 @@ use Magento\Customer\Block\Widget\Name;
- escapeHtml(__('Change Email and Password')) ?> + escapeHtml(__('Change Email and Password')) ?>
- +
getRequiredCharacterClassesNumber() ?>
- escapeHtml(__('Password Strength')) ?>: + escapeHtml(__('Password Strength')) ?>: - escapeHtml(__('No Password')) ?> + escapeHtml(__('No Password')) ?>
@@ -96,7 +103,7 @@ use Magento\Customer\Block\Widget\Name;
-
@@ -165,14 +175,14 @@ $scriptString .= << - + class="form send friend" data-hasRequired="escapeHtmlAttr(__('* Required Fields')) ?>">
getBlockHtml('formkey') ?> - escapeHtml(__('Sender')) ?> + escapeHtml(__('Sender')) ?>
- +
-
getBlockHtml('formkey') ?> - escapeHtml(__('Invitee')) ?> + escapeHtml(__('Invitee')) ?>
getMaxRecipients()): ?> renderStyleAsTag("display: none;", 'div#max-recipient-message') ?> @@ -112,7 +122,7 @@
getMaxRecipients()): ?> + escapeHtml(__('Add Invitee')) ?>
@@ -122,11 +132,15 @@
+ class="action submit primary" + canSend() || + $block->getButtonLockManager()->isDisabled('sendfriend_form_submit')): ?> + disabled="disabled" + > + escapeHtml(__('Send Email')) ?>
diff --git a/vendor/magento/framework/View/Element/ButtonLockInterface.php b/vendor/magento/framework/View/Element/ButtonLockInterface.php new file mode 100644 index 000000000000..e65ce3f245a8 --- /dev/null +++ b/vendor/magento/framework/View/Element/ButtonLockInterface.php @@ -0,0 +1,28 @@ +buttonLockPool = $buttonLockPool; + } + + /** + * Returns true if the button has to be disabled. + * + * @param string $buttonCode + * @return bool + * @throws \Magento\Framework\Exception\InputException + */ + public function isDisabled(string $buttonCode): bool + { + $result = array_filter($this->buttonLockPool, function ($item) use ($buttonCode) { + return $item->getCode() === $buttonCode && $item->isDisabled(); + }); + + return !empty($result); + } +}