Onepage.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * MageSpecialist
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to info@magespecialist.it so we can send you a copy immediately.
  14. *
  15. * @category MSP
  16. * @package MSP_ReCaptcha
  17. * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it)
  18. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  19. */
  20. namespace MSP\ReCaptcha\Block\LayoutProcessor\Checkout;
  21. use Magento\Checkout\Block\Checkout\LayoutProcessorInterface;
  22. use MSP\ReCaptcha\Model\LayoutSettings;
  23. class Onepage implements LayoutProcessorInterface
  24. {
  25. /**
  26. * @var LayoutSettings
  27. */
  28. private $layoutSettings;
  29. /**
  30. * Onepage constructor.
  31. * @param LayoutSettings $layoutSettings
  32. */
  33. public function __construct(
  34. LayoutSettings $layoutSettings
  35. ) {
  36. $this->layoutSettings = $layoutSettings;
  37. }
  38. /**
  39. * Process js Layout of block
  40. *
  41. * @param array $jsLayout
  42. * @return array
  43. */
  44. public function process($jsLayout)
  45. {
  46. $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
  47. ['shippingAddress']['children']['customer-email']['children']
  48. ['msp_recaptcha']['settings'] = $this->layoutSettings->getCaptchaSettings();
  49. $jsLayout['components']['checkout']['children']['authentication']['children']
  50. ['msp_recaptcha']['settings'] = $this->layoutSettings->getCaptchaSettings();
  51. return $jsLayout;
  52. }
  53. }