|
13 | 13 | <?php $_street = $block->getAttributeData()->getFrontendLabel('street'); ?>
|
14 | 14 | <?php $_city = $block->getAttributeData()->getFrontendLabel('city'); ?>
|
15 | 15 | <?php $_region = $block->getAttributeData()->getFrontendLabel('region'); ?>
|
16 |
| -<?php $_data_helper = $this->helper(\Magento\Directory\Helper\Data::class); ?> |
17 |
| -<?php $_address_helper = $this->helper(\Magento\Customer\Helper\Address::class); ?> |
| 16 | +<?php $_selectRegion = 'Please select a region, state or province.'; ?> |
| 17 | +<?php $_displayAll = $block->getConfig('general/region/display_all'); ?> |
| 18 | + |
| 19 | +<?php $_dataHelper = $this->helper(\Magento\Directory\Helper\Data::class); ?> |
| 20 | +<?php $_addressHelper = $this->helper(\Magento\Customer\Helper\Address::class); ?> |
| 21 | + |
| 22 | +<?php $_vatidValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('vat_id')); ?> |
| 23 | +<?php $_cityValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('city')); ?> |
| 24 | +<?php $_postcodeValidationClass_value = $_addressHelper->getAttributeValidationClass('postcode'); ?> |
| 25 | +<?php $_postcodeValidationClass = $block->escapeHtmlAttr($_postcodeValidationClass_value); ?> |
| 26 | +<?php $_streetValidationClass = $_addressHelper->getAttributeValidationClass('street'); ?> |
| 27 | +<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> |
| 28 | +<?php $_regionValidationClass = $block->escapeHtmlAttr($_addressHelper->getAttributeValidationClass('region')); ?> |
| 29 | + |
18 | 30 | <form class="form-address-edit"
|
19 | 31 | action="<?= $block->escapeUrl($block->getSaveUrl()) ?>"
|
20 | 32 | method="post"
|
|
43 | 55 | </fieldset>
|
44 | 56 | <fieldset class="fieldset">
|
45 | 57 | <legend class="legend"><span><?= $block->escapeHtml(__('Address')) ?></span></legend><br>
|
46 |
| - <?php $_streetValidationClass = $_address_helper->getAttributeValidationClass('street'); ?> |
47 | 58 | <div class="field street required">
|
48 | 59 | <label for="street_1" class="label"><span><?= /* @noEscape */ $_street ?></span></label>
|
49 | 60 | <div class="control">
|
|
54 | 65 | id="street_1"
|
55 | 66 | class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"/>
|
56 | 67 | <div class="nested">
|
57 |
| - <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> |
58 |
| - <?php for ($_i = 1, $_n = $_address_helper->getStreetLines(); $_i < $_n; $_i++): ?> |
| 68 | + <?php for ($_i = 1, $_n = $_addressHelper->getStreetLines(); $_i < $_n; $_i++): ?> |
59 | 69 | <div class="field additional">
|
60 | 70 | <label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>">
|
61 | 71 | <span><?= $block->escapeHtml(__('Street Address %1', $_i + 1)) ?></span>
|
|
73 | 83 | </div>
|
74 | 84 | </div>
|
75 | 85 |
|
76 |
| - <?php if ($_address_helper->isVatAttributeVisible()): ?> |
| 86 | + <?php if ($_addressHelper->isVatAttributeVisible()): ?> |
77 | 87 | <div class="field taxvat">
|
78 | 88 | <label class="label" for="vat_id">
|
79 | 89 | <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span>
|
|
83 | 93 | name="vat_id"
|
84 | 94 | value="<?= $block->escapeHtmlAttr($block->getAddress()->getVatId()) ?>"
|
85 | 95 | title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>"
|
86 |
| - class="input-text <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('vat_id')) ?>" |
| 96 | + class="input-text <?= $_vatidValidationClass ?>" |
87 | 97 | id="vat_id">
|
88 | 98 | </div>
|
89 | 99 | </div>
|
|
95 | 105 | name="city"
|
96 | 106 | value="<?= $block->escapeHtmlAttr($block->getAddress()->getCity()) ?>"
|
97 | 107 | title="<?= $block->escapeHtmlAttr(__('City')) ?>"
|
98 |
| - class="input-text <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('city')) ?>" |
| 108 | + class="input-text <?= $_cityValidationClass ?>" |
99 | 109 | id="city">
|
100 | 110 | </div>
|
101 | 111 | </div>
|
|
106 | 116 | <div class="control">
|
107 | 117 | <select id="region_id" name="region_id"
|
108 | 118 | title="<?= /* @noEscape */ $_region ?>"
|
109 |
| - class="validate-select region_id" <?= /* @noEscape */ !$block->getConfig('general/region/display_all') ? ' disabled="disabled"' : '' ?>> |
110 |
| - <option value=""><?= $block->escapeHtml(__('Please select a region, state or province.')) ?></option> |
| 119 | + class="validate-select region_id" |
| 120 | + <?= /* @noEscape */ !$_displayAll ? ' disabled="disabled"' : '' ?>> |
| 121 | + <option value=""><?= $block->escapeHtml(__($_selectRegion)) ?></option> |
111 | 122 | </select>
|
112 | 123 | <input type="text"
|
113 | 124 | id="region"
|
114 | 125 | name="region"
|
115 | 126 | value="<?= $block->escapeHtmlAttr($block->getRegion()) ?>"
|
116 | 127 | title="<?= /* @noEscape */ $_region ?>"
|
117 |
| - class="input-text validate-not-number-first <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('region')) ?>"<?= !$block->getConfig('general/region/display_all') ? ' disabled="disabled"' : '' ?>/> |
| 128 | + class="input-text validate-not-number-first<?= $_regionValidationClass ?>" |
| 129 | + <?= !$_displayAll ? ' disabled="disabled"' : '' ?>/> |
118 | 130 | </div>
|
119 | 131 | </div>
|
120 | 132 | <div class="field zip required">
|
|
127 | 139 | value="<?= $block->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>"
|
128 | 140 | title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>"
|
129 | 141 | id="zip"
|
130 |
| - class="input-text validate-zip-international <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('postcode')) ?>"> |
| 142 | + class="input-text validate-zip-international <?= $_postcodeValidationClass ?>"> |
131 | 143 | <div role="alert" class="message warning" style="display:none">
|
132 | 144 | <span></span>
|
133 | 145 | </div>
|
|
196 | 208 | "#country": {
|
197 | 209 | "regionUpdater": {
|
198 | 210 | "optionalRegionAllowed":
|
199 |
| - <?= /* @noEscape */ $block->getConfig('general/region/display_all') ? 'true' : 'false' ?>, |
| 211 | + <?= /* @noEscape */ $_displayAll ? 'true' : 'false' ?>, |
200 | 212 | "regionListId": "#region_id",
|
201 | 213 | "regionInputId": "#region",
|
202 | 214 | "postcodeId": "#zip",
|
203 | 215 | "form": "#form-validate",
|
204 |
| - "regionJson": <?= /* @noEscape */ $_helper->getRegionJson() ?>, |
| 216 | + "regionJson": <?= /* @noEscape */ $_dataHelper->getRegionJson() ?>, |
205 | 217 | "defaultRegion": "<?= (int) $block->getRegionId() ?>",
|
206 |
| - "countriesWithOptionalZip": <?= /* @noEscape */ $_data_helper->getCountriesWithOptionalZip(true) ?> |
| 218 | + "countriesWithOptionalZip": <?= /* @noEscape */ $_dataHelper->getCountriesWithOptionalZip(true) ?> |
207 | 219 | }
|
208 | 220 | }
|
209 | 221 | }
|
|
0 commit comments