Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Framework\View;
7 
10 
15 {
21  protected $viewConfigs = [];
22 
28  protected $assetRepo;
29 
35  protected $viewConfigFactory;
36 
43  public function __construct(
46  ) {
47  $this->assetRepo = $assetRepo;
48  $this->viewConfigFactory = $viewConfigFactory;
49  }
50 
57  public function getViewConfig(array $params = [])
58  {
59  $this->assetRepo->updateDesignParams($params);
60  $viewConfigParams = [];
61 
62  if (isset($params['themeModel'])) {
64  $currentTheme = $params['themeModel'];
65  $key = $currentTheme->getFullPath();
66  if (isset($this->viewConfigs[$key])) {
67  return $this->viewConfigs[$key];
68  }
69  $viewConfigParams['themeModel'] = $currentTheme;
70  }
71  $viewConfigParams['area'] = (isset($params['area'])) ? $params['area'] : null;
72 
74  $config = $this->viewConfigFactory->create($viewConfigParams);
75 
76  if (isset($key)) {
77  $this->viewConfigs[$key] = $config;
78  }
79  return $config;
80  }
81 }
$config
Definition: fraud_order.php:17
__construct(Repository $assetRepo, ViewFactory $viewConfigFactory)
Definition: Config.php:43
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18