Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GiftOptions.php
Go to the documentation of this file.
1 <?php
7 
11 
17 {
21  protected $_isScopePrivate = false;
22 
26  protected $jsLayout;
27 
31  protected $configProvider;
32 
36  protected $layoutProcessors;
37 
41  protected $jsonEncoder;
42 
50  public function __construct(
51  Context $context,
54  array $layoutProcessors = [],
55  array $data = []
56  ) {
57  parent::__construct($context, $data);
58  $this->jsonEncoder = $jsonEncoder;
59  $this->_isScopePrivate = true;
60  $this->jsLayout = isset($data['jsLayout']) && is_array($data['jsLayout']) ? $data['jsLayout'] : [];
61  $this->configProvider = $configProvider;
62  $this->layoutProcessors = $layoutProcessors;
63  }
64 
68  public function getJsLayout()
69  {
70  foreach ($this->layoutProcessors as $processor) {
71  $this->jsLayout = $processor->process($this->jsLayout);
72  }
73  return $this->jsonEncoder->encode($this->jsLayout);
74  }
75 
81  public function getGiftOptionsConfigJson()
82  {
83  return $this->jsonEncoder->encode($this->configProvider->getConfig());
84  }
85 }
$processor
Definition: 404.php:10
__construct(Context $context, Encoder $jsonEncoder, CompositeConfigProvider $configProvider, array $layoutProcessors=[], array $data=[])
Definition: GiftOptions.php:50