Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FrontendStorageManager.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Catalog\Block;
8 
13 
21 {
25  private $storageConfigurationPool;
26 
30  private $appConfig;
31 
38  public function __construct(
39  Context $context,
40  FrontendStorageConfigurationPool $storageConfigurationPool,
41  Config $appConfig,
42  array $data = []
43  ) {
44  parent::__construct($context, $data);
45  $this->storageConfigurationPool = $storageConfigurationPool;
46  $this->appConfig = $appConfig;
47  }
48 
56  public function getConfigurationJson()
57  {
58  $configuration = $this->getData('configuration') ?: [];
59 
60  foreach ($configuration as $namespace => & $storageConfig) {
61  $dynamicStorage = $this->storageConfigurationPool->get($namespace);
62 
63  if ($dynamicStorage) {
64  $storageConfig = array_replace_recursive($storageConfig, $dynamicStorage->get());
65  }
66 
67  $storageConfig['allowToSendRequest'] = $this->appConfig->getValue(
69  );
70  }
71 
72  return json_encode($configuration);
73  }
74 }
getData($key='', $index=null)
Definition: DataObject.php:119
$configuration
Definition: index.php:33
__construct(Context $context, FrontendStorageConfigurationPool $storageConfigurationPool, Config $appConfig, array $data=[])