1
1
<?php /** @var Magento\Framework\View\TemplateEngine\Php $this */
2
+ $ helper = $ this ->helper ('Idealpostcodes\Ukaddresssearch\Helper\Data ' );
2
3
3
- $ helper = $ this ->helper ('Idealpostcodes\Ukaddresssearch\Helper\Data ' ); ?>
4
-
5
- <script type="text/javascript" name="Ideal_Postcodes">
6
- document.addEventListener('DOMContentLoaded', function() {
7
- var apiKey = "<?php echo $ helper ->getConfig ('api_key ' ); ?> ";
8
- var autocomplete = <?php echo $ helper ->getAdminConfig ('addressAutocomplete ' ); ?> ;
9
- var populateOrganisation = <?php echo $ helper ->getConfig ('populateOrganisation ' ); ?> ;
10
- var populateCounty = <?php echo $ helper ->getConfig ('requireCounty ' ); ?> ;
11
- var enabled = <?php echo $ helper ->getConfig ('enabled ' ); ?> ;
12
- var customFields = <?php echo trim (preg_replace ('/\r|\n/ ' , '' ,$ helper ->getConfig ('customFields ' ))); ?> ;
13
-
4
+ $ script = '
5
+ document.addEventListener( \'DOMContentLoaded \', function() {
6
+ var apiKey = " ' . $ helper ->getConfig ('api_key ' ) . '";
7
+ var autocomplete = ' . $ helper ->getConfig ('addressAutocomplete ' ) . ';
8
+ var populateOrganisation = ' . $ helper ->getConfig ('populateOrganisation ' ) . ';
9
+ var populateCounty = ' . $ helper ->getConfig ('requireCounty ' ) . ';
10
+ var enabled = ' . $ helper ->getConfig ('enabled ' ) . ';
11
+ var customFields = ' . trim (preg_replace ("/ \r| \n/ " , "" , $ helper ->getConfig ('customFields ' ))) . ';
14
12
// Exit early if disabled
15
13
if (enabled === false) return;
16
14
window.idpcConfig = {
@@ -22,7 +20,9 @@ document.addEventListener('DOMContentLoaded', function() {
22
20
hoistCountry: false,
23
21
customFields: customFields
24
22
};
25
-
26
- if (window.idpcStart) window.idpcStart();
23
+ window.idpcStart();
27
24
});
28
- </script>
25
+ ' ;
26
+
27
+ $ secureRenderer ->renderTag ('script ' , [], $ script , false );
28
+ ?>
0 commit comments