component.phtml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. use Magento\Paypal\Block\Express\InContext\Minicart\Button;
  7. /** @var \Magento\Paypal\Block\Express\InContext\Component $block */
  8. $configuration = [
  9. '*' => [
  10. 'Magento_Paypal/js/in-context/express-checkout' => [
  11. 'id' => Button::PAYPAL_BUTTON_ID,
  12. 'path' => $block->getUrl(
  13. 'paypal/express/gettoken',
  14. [
  15. '_secure' => $block->getRequest()->isSecure()
  16. ]
  17. ),
  18. 'merchantId' => $block->getMerchantId(),
  19. 'button' => $block->isButtonContext(),
  20. 'clientConfig' => [
  21. 'locale' => $block->getLocale(),
  22. 'environment' => $block->getEnvironment(),
  23. 'button' => [
  24. Button::PAYPAL_BUTTON_ID,
  25. ],
  26. ]
  27. ]
  28. ]
  29. ];
  30. ?>
  31. <div style="display: none;" id="<?= /* @noEscape */ Button::PAYPAL_BUTTON_ID ?>"></div>
  32. <script type="text/x-magento-init">
  33. <?= /* @noEscape */ json_encode($configuration) ?>
  34. </script>