Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Resolver.php
Go to the documentation of this file.
1 <?php
7 
12 {
16  protected $design;
17 
21  protected $themeFactory;
22 
26  protected $appState;
27 
33  public function __construct(
34  \Magento\Framework\App\State $appState,
35  \Magento\Framework\View\DesignInterface $design,
36  \Magento\Theme\Model\ResourceModel\Theme\CollectionFactory $themeFactory
37  ) {
38  $this->design = $design;
39  $this->themeFactory = $themeFactory;
40  $this->appState = $appState;
41  }
42 
48  public function get()
49  {
50  $area = $this->appState->getAreaCode();
51  if ($this->design->getDesignTheme()->getArea() == $area || $this->design->getArea() == $area) {
52  return $this->design->getDesignTheme();
53  }
54 
56  $themeCollection = $this->themeFactory->create();
57  $themeIdentifier = $this->design->getConfigurationDesignTheme($area);
58  if (is_numeric($themeIdentifier)) {
59  $result = $themeCollection->getItemById($themeIdentifier);
60  } else {
61  $themeFullPath = $area . \Magento\Framework\View\Design\ThemeInterface::PATH_SEPARATOR . $themeIdentifier;
62  $result = $themeCollection->getThemeByFullPath($themeFullPath);
63  }
64  return $result;
65  }
66 }
__construct(\Magento\Framework\App\State $appState, \Magento\Framework\View\DesignInterface $design, \Magento\Theme\Model\ResourceModel\Theme\CollectionFactory $themeFactory)
Definition: Resolver.php:33