4
4
* See COPYING.txt for license details.
5
5
*/
6
6
7
- // @codingStandardsIgnoreFile
8
-
9
7
/** @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Text */
10
8
11
9
$ stores = $ block ->getStoresSortedBySortOrder ();
@@ -20,9 +18,8 @@ $stores = $block->getStoresSortedBySortOrder();
20
18
<tr id="swatch-text-options-table">
21
19
<th class="col-draggable"></th>
22
20
<th class="col-default"><span><?= $ block ->escapeHtml (__ ('Is Default ' )) ?> </span></th>
23
- <?php foreach ($ stores as $ _store ): ?>
24
- <th class="col-swatch col-swatch-min-width col-<%- data.id %>
25
- <?php if ($ _store ->getId () == \Magento \Store \Model \Store::DEFAULT_STORE_ID ): ?> _required<?php endif ; ?> "
21
+ <?php foreach ($ stores as $ _store ) : ?>
22
+ <th class="col-swatch col-swatch-min-width col-<%- data.id %><?= ($ _store ->getId () == \Magento \Store \Model \Store::DEFAULT_STORE_ID ) ? ' _required ' : '' ?> "
26
23
colspan="2">
27
24
<span><?= $ block ->escapeHtml ($ _store ->getName ()) ?> </span>
28
25
</th>
@@ -41,7 +38,7 @@ $stores = $block->getStoresSortedBySortOrder();
41
38
</tr>
42
39
<tr>
43
40
<th colspan="<?= (int )$ colTotal ?> " class="col-actions-add">
44
- <?php if (!$ block ->getReadOnly () && !$ block ->canManageOptionDefaultOnly ()): ?>
41
+ <?php if (!$ block ->getReadOnly () && !$ block ->canManageOptionDefaultOnly ()) : ?>
45
42
<button id="add_new_swatch_text_option_button"
46
43
title="<?= $ block ->escapeHtml (__ ('Add Swatch ' )) ?> "
47
44
type="button" class="action- scalable add">
@@ -57,44 +54,44 @@ $stores = $block->getStoresSortedBySortOrder();
57
54
<script id="swatch-text-row-template" type="text/x-magento-template">
58
55
<tr>
59
56
<td class="col-draggable">
60
- <?php if (!$ block ->getReadOnly () && !$ block ->canManageOptionDefaultOnly ()): ?>
57
+ <?php if (!$ block ->getReadOnly () && !$ block ->canManageOptionDefaultOnly ()) : ?>
61
58
<div data-role="draggable-handle"
62
59
class="draggable-handle"
63
- title="<?= $ block ->escapeHtml (__ ('Sort Option ' )) ?> "></div>
60
+ title="<?= $ block ->escapeHtmlAttr (__ ('Sort Option ' )) ?> "></div>
64
61
<?php endif ; ?>
65
62
<input data-role="order" type="hidden" name="optiontext[order][<%- data.id %>]"
66
63
value="<%- data.sort_order %>"
67
- <?php if ($ block ->getReadOnly () || $ block ->canManageOptionDefaultOnly ()): ?> disabled="disabled"<?php endif ; ?>
64
+ <?= ($ block ->getReadOnly () || $ block ->canManageOptionDefaultOnly ()) ? ' disabled="disabled"' : '' ?>
68
65
/>
69
66
</td>
70
67
<td class="col-default">
71
68
<input class="input-radio"
72
69
type="<%- data.intype %>"
73
70
name="defaulttext[]"
74
- value="<%- data.id %>" <%- data.checked %><?php if ($ block ->getReadOnly ()): ?> disabled="disabled"<?php endif ; ?> />
71
+ value="<%- data.id %>" <%- data.checked %><?= ($ block ->getReadOnly ()) ? ' disabled="disabled"' : '' ?> />
75
72
</td>
76
- <?php foreach ($ stores as $ _store ): ?>
73
+ <?php foreach ($ stores as $ _store ) : ?>
77
74
<?php $ storeId = (int )$ _store ->getId (); ?>
78
75
<td class="col-swatch col-swatch-min-width col-<%- data.id %>">
79
76
<input class="input-text
80
77
swatch-text-field-<?= /* @noEscape */ $ storeId ?>
81
- <?php if ($ storeId == \Magento \Store \Model \Store::DEFAULT_STORE_ID ): ?> required-option required-unique<?php endif ; ?> "
78
+ <?= ($ storeId == \Magento \Store \Model \Store::DEFAULT_STORE_ID ) ? ' required-option required-unique' : '' ?> "
82
79
name="swatchtext[value][<%- data.id %>][<?= /* @noEscape */ $ storeId ?> ]"
83
80
type="text" value="<%- data.swatch<?= /* @noEscape */ $ storeId ?> %>"
84
- placeholder="<?= $ block ->escapeHtml (__ ("Swatch " )) ?> "/>
81
+ placeholder="<?= $ block ->escapeHtmlAttr (__ ("Swatch " )) ?> "/>
85
82
</td>
86
83
<td class="col-swatch-min-width swatch-col-<%- data.id %>">
87
84
<input name="optiontext[value][<%- data.id %>][<?= /* @noEscape */ $ storeId ?> ]"
88
85
value="<%- data.store<?= /* @noEscape */ $ storeId ?> %>"
89
- class="input-text<?php if ($ storeId == \Magento \Store \Model \Store::DEFAULT_STORE_ID ): ?> required-option<?php endif ; ?> "
90
- type="text" <?php if ($ block ->getReadOnly () || $ block ->canManageOptionDefaultOnly ()): ?> disabled="disabled"<?php endif ; ?>
91
- placeholder="<?= $ block ->escapeHtml (__ ("Description " )) ?> "/>
86
+ class="input-text<?= ($ storeId == \Magento \Store \Model \Store::DEFAULT_STORE_ID ) ? ' required-option' : '' ?> "
87
+ type="text" <?= ($ block ->getReadOnly () || $ block ->canManageOptionDefaultOnly ()) ? ' disabled="disabled"' : '' ?>
88
+ placeholder="<?= $ block ->escapeHtmlAttr (__ ("Description " )) ?> "/>
92
89
</td>
93
90
<?php endforeach ; ?>
94
91
<td id="delete_button_swatch_container_<%- data.id %>" class="col-delete">
95
92
<input type="hidden" class="delete-flag" name="optiontext[delete][<%- data.id %>]" value="" />
96
- <?php if (!$ block ->getReadOnly () && !$ block ->canManageOptionDefaultOnly ()): ?>
97
- <button title="<?= $ block ->escapeHtml (__ ('Delete ' )) ?> " type="button"
93
+ <?php if (!$ block ->getReadOnly () && !$ block ->canManageOptionDefaultOnly ()) : ?>
94
+ <button title="<?= $ block ->escapeHtmlAttr (__ ('Delete ' )) ?> " type="button"
98
95
class="action- scalable delete delete-option">
99
96
<span><?= $ block ->escapeHtml (__ ('Delete ' )) ?> </span>
100
97
</button>
@@ -105,10 +102,10 @@ $stores = $block->getStoresSortedBySortOrder();
105
102
<script type="text/x-magento-init">
106
103
{
107
104
"*": {
108
- "Magento_Swatches/js/text": <?= /* @escapeNotVerified */ $ block ->getJsonConfig () ?> ,
105
+ "Magento_Swatches/js/text": <?= /* @noEscape */ $ block ->getJsonConfig () ?> ,
109
106
"Magento_Catalog/catalog/product/attribute/unique-validate": {
110
107
"element": "required-text-swatch-unique",
111
- "message": "<?= $ block ->escapeHtml (__ ("The value of Admin must be unique. " )) ?> "
108
+ "message": "<?= $ block ->escapeJs ( $ block -> escapeHtml (__ ("The value of Admin must be unique. " ) )) ?> "
112
109
}
113
110
}
114
111
}
0 commit comments