Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Shipping.php
Go to the documentation of this file.
1 <?php
7 
13 class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
14 {
18  protected $configProvider;
19 
23  protected $layoutProcessors;
24 
28  private $serializer;
29 
40  public function __construct(
41  \Magento\Framework\View\Element\Template\Context $context,
42  \Magento\Customer\Model\Session $customerSession,
43  \Magento\Checkout\Model\Session $checkoutSession,
44  \Magento\Checkout\Model\CompositeConfigProvider $configProvider,
45  array $layoutProcessors = [],
46  array $data = [],
47  \Magento\Framework\Serialize\Serializer\Json $serializer = null
48  ) {
49  $this->configProvider = $configProvider;
50  $this->layoutProcessors = $layoutProcessors;
51  parent::__construct($context, $customerSession, $checkoutSession, $data);
52  $this->_isScopePrivate = true;
53  $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
54  ->get(\Magento\Framework\Serialize\Serializer\Json::class);
55  }
56 
63  public function getCheckoutConfig()
64  {
65  return $this->configProvider->getConfig();
66  }
67 
73  public function getJsLayout()
74  {
75  foreach ($this->layoutProcessors as $processor) {
76  $this->jsLayout = $processor->process($this->jsLayout);
77  }
78 
79  return json_encode($this->jsLayout, JSON_HEX_TAG);
80  }
81 
88  public function getBaseUrl()
89  {
90  return $this->_storeManager->getStore()->getBaseUrl();
91  }
92 
97  public function getSerializedCheckoutConfig()
98  {
99  return json_encode($this->getCheckoutConfig(), JSON_HEX_TAG);
100  }
101 }
$processor
Definition: 404.php:10
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Checkout\Model\CompositeConfigProvider $configProvider, array $layoutProcessors=[], array $data=[], \Magento\Framework\Serialize\Serializer\Json $serializer=null)
Definition: Shipping.php:40