Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerScopeData.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Customer\Block;
7 
10 
21 {
25  private $storeManager;
26 
30  private $serializer;
31 
40  public function __construct(
41  \Magento\Framework\View\Element\Template\Context $context,
42  \Magento\Framework\Json\EncoderInterface $jsonEncoder,
43  array $data = [],
44  Json $serializer = null
45  ) {
46  parent::__construct($context, $data);
47  $this->storeManager = $context->getStoreManager();
48  $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
49  }
50 
59  public function getWebsiteId()
60  {
61  return (int)$this->_storeManager->getStore()->getWebsiteId();
62  }
63 
71  public function encodeConfiguration(array $configuration)
72  {
73  return $this->serializer->serialize($configuration);
74  }
75 }
$configuration
Definition: index.php:33
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, array $data=[], Json $serializer=null)