|
5 | 5 | */ |
6 | 6 |
|
7 | 7 | /** @var \Magento\Contact\Block\ContactForm $block */ |
| 8 | +/** @var \Magento\Contact\ViewModel\UserDataProvider $viewModel */ |
| 9 | + |
| 10 | +$viewModel = $block->getViewModel(); |
8 | 11 | ?> |
9 | 12 | <form class="form contact" |
10 | 13 | action="<?= $block->escapeUrl($block->getFormAction()) ?>" |
|
18 | 21 | <div class="field name required"> |
19 | 22 | <label class="label" for="name"><span><?= $block->escapeHtml(__('Name')) ?></span></label> |
20 | 23 | <div class="control"> |
21 | | - <input name="name" id="name" title="<?= $block->escapeHtmlAttr(__('Name')) ?>" value="<?= $block->escapeHtmlAttr($this->helper(\Magento\Contact\Helper\Data::class)->getPostValue('name') ?: $this->helper(\Magento\Contact\Helper\Data::class)->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/> |
| 24 | + <input name="name" id="name" title="<?= $block->escapeHtmlAttr(__('Name')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/> |
22 | 25 | </div> |
23 | 26 | </div> |
24 | 27 | <div class="field email required"> |
25 | 28 | <label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label> |
26 | 29 | <div class="control"> |
27 | | - <input name="email" id="email" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" value="<?= $block->escapeHtmlAttr($this->helper(\Magento\Contact\Helper\Data::class)->getPostValue('email') ?: $this->helper(\Magento\Contact\Helper\Data::class)->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/> |
| 30 | + <input name="email" id="email" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>" class="input-text" type="email" data-validate="{required:true, 'validate-email':true}"/> |
28 | 31 | </div> |
29 | 32 | </div> |
30 | 33 | <div class="field telephone"> |
31 | 34 | <label class="label" for="telephone"><span><?= $block->escapeHtml(__('Phone Number')) ?></span></label> |
32 | 35 | <div class="control"> |
33 | | - <input name="telephone" id="telephone" title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>" value="<?= $block->escapeHtmlAttr($this->helper(\Magento\Contact\Helper\Data::class)->getPostValue('telephone')) ?>" class="input-text" type="text" /> |
| 36 | + <input name="telephone" id="telephone" title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>" value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>" class="input-text" type="text" /> |
34 | 37 | </div> |
35 | 38 | </div> |
36 | 39 | <div class="field comment required"> |
37 | 40 | <label class="label" for="comment"><span><?= $block->escapeHtml(__('What’s on your mind?')) ?></span></label> |
38 | 41 | <div class="control"> |
39 | | - <textarea name="comment" id="comment" title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"><?= $block->escapeHtml($this->helper(\Magento\Contact\Helper\Data::class)->getPostValue('comment')) ?></textarea> |
| 42 | + <textarea name="comment" id="comment" title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>" class="input-text" cols="5" rows="3" data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?></textarea> |
40 | 43 | </div> |
41 | 44 | </div> |
42 | 45 | <?= $block->getChildHtml('form.additional.info') ?> |
|
0 commit comments