59 if (!is_numeric($themeKey) && !is_string($themeKey)) {
60 throw new \InvalidArgumentException(
'Incorrect theme identification key');
62 $themeKey = $this->extractThemeId($themeKey);
63 if (is_numeric($themeKey)) {
64 $themeModel = $this->
_loadById($themeKey);
68 if (!$themeModel->getCode()) {
69 throw new \LogicException(
"Unable to load theme by specified key: '{$themeKey}'");
81 private function extractThemeId(
$path)
84 if (preg_match(
'/^' . preg_quote($dir,
'/') .
'(\d+)$/',
$path, $matches)) {
98 if (isset($this->themes[$themeId])) {
99 return $this->themes[$themeId];
102 return $this->themeProvider->getThemeById($themeId);
115 if (isset($this->themesByPath[$fullPath])) {
116 return $this->themesByPath[$fullPath];
119 return $this->themeProvider->getThemeByFullPath($fullPath);
130 if ($themeModel->getId()) {
131 $this->themes[$themeModel->getId()] = $themeModel;
132 $themePath = $themeModel->getFullPath();
134 $this->themesByPath[$themePath] = $themeModel;
create($themeKey, $area=\Magento\Framework\View\DesignInterface::DEFAULT_AREA)
_loadByPath($themePath, $area)
_addTheme(\Magento\Framework\View\Design\ThemeInterface $themeModel)
__construct(ThemeProviderInterface $themeProvider)