Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
script.phtml
Go to the documentation of this file.
1 <?php
9 $code = $block->escapeHtml($block->getCode());
10 
11 ?>
12 <script>
13  //<![CDATA[
14  require(
15  [
16  'Magento_Braintree/js/braintree',
17  'jquery',
18  'domReady!'
19  ], function(Braintree, $) {
20  var config = <?= /* @noEscape */ $block->getPaymentConfig() ?>,
21  payment,
22  form = $('#payment_form_<?= /* @noEscape */ $code ?>');
23 
24  config.active = form.length > 0 && !form.is(':hidden');
25  payment = new Braintree(config);
26  });
27  //]]>
28 </script>
$code
Definition: script.phtml:9
jquery extjs ext tree mage adminhtml form
Definition: tree.phtml:41
$block
Definition: block.php:8