|
5 | 5 | */
|
6 | 6 |
|
7 | 7 | // @codingStandardsIgnoreFile
|
8 |
| - |
9 | 8 | ?>
|
10 | 9 | <?php
|
11 | 10 | /**
|
12 |
| - * @var \Magento\CurrencySymbol\Block\Adminhtml\System\Currencysymbol $block |
| 11 | + * @var $block \Magento\CurrencySymbol\Block\Adminhtml\System\Currencysymbol |
13 | 12 | */
|
14 |
| -?> |
15 | 13 |
|
16 |
| -<form id="currency-symbols-form" action="<?= /* @escapeNotVerified */ $block->getFormActionUrl() ?>" method="post"> |
17 |
| - <input name="form_key" type="hidden" value="<?= /* @escapeNotVerified */ $block->getFormKey() ?>" /> |
| 14 | +$escapeHelper = $this->helper(\Magento\Framework\EscapeHelper::class); |
| 15 | +?> |
| 16 | +<form id="currency-symbols-form" action="<? echo $escapeHelper->escapeHtmlAttr($block->getFormActionUrl()) ?>" method="post"> |
| 17 | + <input name="form_key" type="hidden" value="<? echo $escapeHelper->escapeHtmlAttr($block->getFormKey()) ?>" /> |
18 | 18 | <fieldset class="admin__fieldset">
|
19 | 19 | <?php foreach ($block->getCurrencySymbolsData() as $code => $data): ?>
|
20 | 20 | <div class="admin__field _required">
|
21 |
| - <label class="admin__field-label" for="custom_currency_symbol<?php /* @escapeNotVerified */ echo $code; ?>"> |
22 |
| - <span><?php /* @escapeNotVerified */ echo $code; ?> (<?php /* @escapeNotVerified */ echo $data['displayName']; ?>)</span> |
| 21 | + <label class="admin__field-label" for="custom_currency_symbol<?php echo $escapeHelper->escapeHtmlAttr($code); ?>"> |
| 22 | + <span><?php echo $block->escapeHtml($code); ?> (<?php echo $block->escapeHtml($data['displayName']); ?>)</span> |
23 | 23 | </label>
|
24 | 24 | <div class="admin__field-control">
|
25 |
| - <input id="custom_currency_symbol<?php /* @escapeNotVerified */ echo $code; ?>" |
| 25 | + <input id="custom_currency_symbol<?php echo $escapeHelper->escapeHtmlAttr($code); ?>" |
26 | 26 | class="required-entry admin__control-text"
|
27 | 27 | type="text"
|
28 |
| - value="<?php echo $this->helper(\Magento\Framework\EscapeHelper::class)->escapeHtmlAttr($data['displaySymbol']); ?>" |
| 28 | + value="<?php echo $escapeHelper->escapeHtmlAttr($data['displaySymbol']); ?>" |
29 | 29 | <?php echo $data['inherited'] ? ' disabled="disabled"' : '';?>
|
30 |
| - name="custom_currency_symbol[<?php /* @escapeNotVerified */ echo $code; ?>]"> |
| 30 | + name="custom_currency_symbol[<?php echo $escapeHelper->escapeHtmlAttr($code); ?>]"> |
31 | 31 | <div class="admin__field admin__field-option">
|
32 |
| - <input id="custom_currency_symbol_inherit<?php /* @escapeNotVerified */ echo $code; ?>" |
| 32 | + <input id="custom_currency_symbol_inherit<?php echo $escapeHelper->escapeHtmlAttr($code); ?>" |
33 | 33 | class="admin__control-checkbox" type="checkbox"
|
34 |
| - onclick="toggleUseDefault(<?php /* @escapeNotVerified */ echo '\'' . $code . '\',\'' . $block->escapeQuote($data['parentSymbol'], true) . '\''; ?>)" |
| 34 | + onclick="toggleUseDefault(<?php echo '\'' . $escapeHelper->escapeHtmlAttr($block->escapeQuote($code, true)) . '\',\'' . $block->escapeQuote($data['parentSymbol'], true) . '\''; ?>)" |
35 | 35 | <?php echo $data['inherited'] ? ' checked="checked"' : ''; ?>
|
36 | 36 | value="1"
|
37 |
| - name="inherit_custom_currency_symbol[<?php /* @escapeNotVerified */ echo $code; ?>]"> |
38 |
| - <label class="admin__field-label" for="custom_currency_symbol_inherit<?php /* @escapeNotVerified */ echo $code; ?>"><span><?php /* @escapeNotVerified */ echo $block->getInheritText(); ?></span></label> |
| 37 | + name="inherit_custom_currency_symbol[<?php echo $escapeHelper->escapeHtmlAttr($code); ?>]"> |
| 38 | + <label class="admin__field-label" for="custom_currency_symbol_inherit<?php echo $escapeHelper->escapeHtmlAttr($code); ?>"><span><?php echo $block->escapeHtml($block->getInheritText()); ?></span></label> |
39 | 39 | </div>
|
40 | 40 | </div>
|
41 | 41 | </div>
|
42 | 42 | <?php endforeach; ?>
|
43 | 43 | </fieldset>
|
44 | 44 | </form>
|
45 | 45 | <script>
|
46 |
| -require(['jquery', "mage/mage", 'prototype'], function(jQuery){ |
| 46 | +require(['jquery', 'mage/mage'], function (jQuery){ |
| 47 | + jQuery('#currency-symbols-form') |
| 48 | + .mage('form') |
| 49 | + .mage('validation'); |
47 | 50 |
|
48 |
| - jQuery('#currency-symbols-form').mage('form').mage('validation'); |
| 51 | + /** |
| 52 | + * Toggle the field to use the default value |
| 53 | + * |
| 54 | + * @param {String} code |
| 55 | + * @param {String} value |
| 56 | + */ |
| 57 | + function toggleUseDefault(code, value) { |
| 58 | + var checkbox = jQuery('#custom_currency_symbol_inherit' + code), |
| 59 | + input = jQuery('#custom_currency_symbol' + code); |
49 | 60 |
|
50 |
| - function toggleUseDefault(code, value) |
51 |
| - { |
52 |
| - checkbox = $('custom_currency_symbol_inherit'+code); |
53 |
| - input = $('custom_currency_symbol'+code); |
54 |
| - if (checkbox.checked) { |
55 |
| - input.value = value; |
56 |
| - input.disabled = true; |
| 61 | + if (checkbox.is(':checked')) { |
| 62 | + input.val(value); |
| 63 | + input.prop('disabled', true); |
57 | 64 | } else {
|
58 |
| - input.disabled = false; |
| 65 | + input.prop('disabled', false); |
59 | 66 | }
|
60 | 67 | }
|
61 | 68 |
|
|
0 commit comments