Skip to content

Commit 0edeb06

Browse files
committed
Shorten lines to resolve codestyle warnings
1 parent 574f052 commit 0edeb06

File tree

1 file changed

+27
-15
lines changed
  • app/code/Magento/Customer/view/frontend/templates/address

1 file changed

+27
-15
lines changed

app/code/Magento/Customer/view/frontend/templates/address/edit.phtml

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,20 @@
1313
<?php $_street = $block->getAttributeData()->getFrontendLabel('street'); ?>
1414
<?php $_city = $block->getAttributeData()->getFrontendLabel('city'); ?>
1515
<?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+
1830
<form class="form-address-edit"
1931
action="<?= $block->escapeUrl($block->getSaveUrl()) ?>"
2032
method="post"
@@ -43,7 +55,6 @@
4355
</fieldset>
4456
<fieldset class="fieldset">
4557
<legend class="legend"><span><?= $block->escapeHtml(__('Address')) ?></span></legend><br>
46-
<?php $_streetValidationClass = $_address_helper->getAttributeValidationClass('street'); ?>
4758
<div class="field street required">
4859
<label for="street_1" class="label"><span><?= /* @noEscape */ $_street ?></span></label>
4960
<div class="control">
@@ -54,8 +65,7 @@
5465
id="street_1"
5566
class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"/>
5667
<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++): ?>
5969
<div class="field additional">
6070
<label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>">
6171
<span><?= $block->escapeHtml(__('Street Address %1', $_i + 1)) ?></span>
@@ -73,7 +83,7 @@
7383
</div>
7484
</div>
7585

76-
<?php if ($_address_helper->isVatAttributeVisible()): ?>
86+
<?php if ($_addressHelper->isVatAttributeVisible()): ?>
7787
<div class="field taxvat">
7888
<label class="label" for="vat_id">
7989
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span>
@@ -83,7 +93,7 @@
8393
name="vat_id"
8494
value="<?= $block->escapeHtmlAttr($block->getAddress()->getVatId()) ?>"
8595
title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>"
86-
class="input-text <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('vat_id')) ?>"
96+
class="input-text <?= $_vatidValidationClass ?>"
8797
id="vat_id">
8898
</div>
8999
</div>
@@ -95,7 +105,7 @@
95105
name="city"
96106
value="<?= $block->escapeHtmlAttr($block->getAddress()->getCity()) ?>"
97107
title="<?= $block->escapeHtmlAttr(__('City')) ?>"
98-
class="input-text <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('city')) ?>"
108+
class="input-text <?= $_cityValidationClass ?>"
99109
id="city">
100110
</div>
101111
</div>
@@ -106,15 +116,17 @@
106116
<div class="control">
107117
<select id="region_id" name="region_id"
108118
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>
111122
</select>
112123
<input type="text"
113124
id="region"
114125
name="region"
115126
value="<?= $block->escapeHtmlAttr($block->getRegion()) ?>"
116127
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"' : '' ?>/>
118130
</div>
119131
</div>
120132
<div class="field zip required">
@@ -127,7 +139,7 @@
127139
value="<?= $block->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>"
128140
title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>"
129141
id="zip"
130-
class="input-text validate-zip-international <?= $block->escapeHtmlAttr($_address_helper->getAttributeValidationClass('postcode')) ?>">
142+
class="input-text validate-zip-international <?= $_postcodeValidationClass ?>">
131143
<div role="alert" class="message warning" style="display:none">
132144
<span></span>
133145
</div>
@@ -196,14 +208,14 @@
196208
"#country": {
197209
"regionUpdater": {
198210
"optionalRegionAllowed":
199-
<?= /* @noEscape */ $block->getConfig('general/region/display_all') ? 'true' : 'false' ?>,
211+
<?= /* @noEscape */ $_displayAll ? 'true' : 'false' ?>,
200212
"regionListId": "#region_id",
201213
"regionInputId": "#region",
202214
"postcodeId": "#zip",
203215
"form": "#form-validate",
204-
"regionJson": <?= /* @noEscape */ $_helper->getRegionJson() ?>,
216+
"regionJson": <?= /* @noEscape */ $_dataHelper->getRegionJson() ?>,
205217
"defaultRegion": "<?= (int) $block->getRegionId() ?>",
206-
"countriesWithOptionalZip": <?= /* @noEscape */ $_data_helper->getCountriesWithOptionalZip(true) ?>
218+
"countriesWithOptionalZip": <?= /* @noEscape */ $_dataHelper->getCountriesWithOptionalZip(true) ?>
207219
}
208220
}
209221
}

0 commit comments

Comments
 (0)