File tree Expand file tree Collapse file tree
view/adminhtml/templates/form Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,7 +67,13 @@ public function getBlock(): AbstractBlock
6767
6868 public function getFieldAttributes (): array
6969 {
70- return (array )$ this ->getData ('field_attributes ' );
70+ $ fieldAttributes = (array )$ this ->getData ('field_attributes ' );
71+
72+ if ($ this ->isRequired ()) {
73+ $ fieldAttributes ['required ' ] = null ;
74+ }
75+
76+ return $ fieldAttributes ;
7177 }
7278
7379 public function getLabelAttributes (): array
Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ if (!empty($depends)) {
4444 <div class="admin__field-label">
4545 <label for="<?= $ escaper ->escapeHtml ($ field ->getCode ()) ?> ">
4646 <span><?= $ escaper ->escapeHtml ($ field ->getLabel ()) ?> </span>
47+ <?php if ($ field ->isRequired ()): ?>
48+ <span style="color:red">*</span>
49+ <?php endif ; ?>
4750 </label>
4851 </div>
4952
Original file line number Diff line number Diff line change @@ -30,7 +30,11 @@ if (isset($fieldAttributes['type'])) {
3030 name="<?= $ escaper ->escapeHtml ($ field ->getCode ()) ?> "
3131 data-name="<?= $ escaper ->escapeHtml ($ field ->getCode ()) ?> "
3232 <?php foreach ($ fieldAttributes as $ attributeName => $ attributeValue ) : ?>
33- <?= /* @noEscape */ $ attributeName ?> ="<?= /* @noEscape */ $ attributeValue ?> "
33+ <?php if ($ attributeValue === null ): ?>
34+ <?= /* @noEscape */ $ attributeName ?>
35+ <?php else : ?>
36+ <?= /* @noEscape */ $ attributeName ?> ="<?= /* @noEscape */ $ attributeValue ?> "
37+ <?php endif ; ?>
3438 <?php endforeach ; ?>
3539 :value="<?= $ escaper ->escapeHtml ($ field ->getScope ()) ?> .<?= $ escaper ->escapeHtml ($ field ->getCode ()) ?> "
3640 @change="<?= $ escaper ->escapeHtml ($ field ->getAlpineSetter ()) ?> "
You can’t perform that action at this time.
0 commit comments