File tree Expand file tree Collapse file tree 6 files changed +65
-2
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 6 files changed +65
-2
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \Customer \ViewModel ;
9
+
10
+ use Magento \Framework \View \Element \Block \ArgumentInterface ;
11
+
12
+ /**
13
+ * Custom Create Account button view model
14
+ */
15
+ class CreateAccountButton implements ArgumentInterface
16
+ {
17
+ /**
18
+ * If Create Account button should be disabled
19
+ *
20
+ * @return bool
21
+ */
22
+ public function disabled (): bool
23
+ {
24
+ return false ;
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \Customer \ViewModel ;
9
+
10
+ use Magento \Framework \View \Element \Block \ArgumentInterface ;
11
+
12
+ /**
13
+ * Custom Login button view model
14
+ */
15
+ class LoginButton implements ArgumentInterface
16
+ {
17
+ /**
18
+ * If Login button should be disabled
19
+ *
20
+ * @return bool
21
+ */
22
+ public function disabled (): bool
23
+ {
24
+ return false ;
25
+ }
26
+ }
Original file line number Diff line number Diff line change 18
18
<arguments >
19
19
<argument name =" attribute_data" xsi : type =" object" >Magento\Customer\Block\DataProviders\AddressAttributeData</argument >
20
20
<argument name =" region_provider" xsi : type =" object" >Magento\Customer\ViewModel\Address\RegionProvider</argument >
21
+ <argument name =" create_account_button_view_model" xsi : type =" object" >Magento\Customer\ViewModel\CreateAccountButton</argument >
21
22
</arguments >
22
23
<container name =" form.additional.info" as =" form_additional_info" />
23
24
<container name =" customer.form.register.fields.before" as =" form_fields_before" label =" Form Fields Before" htmlTag =" div" htmlClass =" customer-form-before" />
Original file line number Diff line number Diff line change 15
15
<container name =" customer.login.container" label =" Customer Login Container" htmlTag =" div" htmlClass =" login-container" >
16
16
<block class =" Magento\Customer\Block\Form\Login" name =" customer_form_login" template =" Magento_Customer::form/login.phtml" >
17
17
<container name =" form.additional.info" as =" form_additional_info" />
18
+ <arguments >
19
+ <argument name =" login_button_view_model" xsi : type =" object" >Magento\Customer\ViewModel\LoginButton</argument >
20
+ </arguments >
18
21
</block >
19
22
<block class =" Magento\Customer\Block\Form\Login\Info" name =" customer.new" template =" Magento_Customer::newcustomer.phtml" />
20
23
</container >
Original file line number Diff line number Diff line change 7
7
// phpcs:disable Generic.Files.LineLength.TooLong
8
8
9
9
/** @var \Magento\Customer\Block\Form\Login $block */
10
+ /** @var \Magento\Customer\ViewModel\LoginButton $loginButtonViewModel */
11
+ $ loginButtonViewModel = $ block ->getData ('login_button_view_model ' );
10
12
?>
11
13
<div class="block block-customer-login">
12
14
<div class="block-title">
47
49
</div>
48
50
<?= $ block ->getChildHtml ('form_additional_info ' ) ?>
49
51
<div class="actions-toolbar">
50
- <div class="primary"><button type="submit" class="action login primary" name="send" id="send2"><span><?= $ block ->escapeHtml (__ ('Sign In ' )) ?> </span></button></div>
52
+ <div class="primary"><button type="submit" class="action login primary" name="send" id="send2" <?php if ( $ loginButtonViewModel -> disabled ()): ?> disabled="disabled" <?php endif ; ?> ><span><?= $ block ->escapeHtml (__ ('Sign In ' )) ?> </span></button></div>
51
53
<div class="secondary"><a class="action remind" href="<?= $ block ->escapeUrl ($ block ->getForgotPasswordUrl ()) ?> "><span><?= $ block ->escapeHtml (__ ('Forgot Your Password? ' )) ?> </span></a></div>
52
54
</div>
53
55
</fieldset>
54
56
</form>
55
57
</div>
58
+ <?php // phpcs:ignore Magento2.Legacy.PhtmlTemplate ?>
56
59
<script type="text/x-magento-init">
57
60
{
58
61
"*": {
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ $directoryHelper = $block->getData('directoryHelper');
17
17
/** @var \Magento\Customer\ViewModel\Address\RegionProvider $regionProvider */
18
18
$ regionProvider = $ block ->getRegionProvider ();
19
19
$ formData = $ block ->getFormData ();
20
+ /** @var \Magento\Customer\ViewModel\CreateAccountButton $createAccountButtonViewModel */
21
+ $ createAccountButtonViewModel = $ block ->getData ('create_account_button_view_model ' );
20
22
?>
21
23
<?php $ displayAll = $ block ->getConfig ('general/region/display_all ' ); ?>
22
24
<?= $ block ->getChildHtml ('form_fields_before ' ) ?>
@@ -291,7 +293,9 @@ $formData = $block->getFormData();
291
293
<div class="primary">
292
294
<button type="submit"
293
295
class="action submit primary"
294
- title="<?= $ escaper ->escapeHtmlAttr (__ ('Create an Account ' )) ?> ">
296
+ title="<?= $ escaper ->escapeHtmlAttr (__ ('Create an Account ' )) ?> "
297
+ id="send2"
298
+ <?php if ($ createAccountButtonViewModel ->disabled ()): ?> disabled="disabled" <?php endif ; ?> >
295
299
<span><?= $ escaper ->escapeHtml (__ ('Create an Account ' )) ?> </span>
296
300
</button>
297
301
</div>
You can’t perform that action at this time.
0 commit comments