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