Skip to content

Commit 72ed28e

Browse files
#10402 fix theme templates overrides in environment emulation cross-area
Load theme by full path only in case we received a 'theme' in $params
1 parent 030b6c9 commit 72ed28e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lib/internal/Magento/Framework/View/Asset/Repository.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,26 @@ public function updateDesignParams(array &$params)
135135
}
136136

137137
// Set themeModel
138-
$theme = null;
138+
$themeId = null;
139+
$themePath = null;
139140
$area = $params['area'];
140141
if (!empty($params['themeId'])) {
141-
$theme = $params['themeId'];
142+
$themeId = $params['themeId'];
142143
} elseif (isset($params['theme'])) {
143-
$theme = $params['theme'];
144+
$themePath = $params['theme'];
144145
} elseif (empty($params['themeModel']) && $area !== $this->getDefaultParameter('area')) {
145-
$theme = $this->design->getConfigurationDesignTheme($area);
146+
$themeId = $this->design->getConfigurationDesignTheme($area);
146147
}
147148

148-
if ($theme) {
149-
$params['themeModel'] = $this->getThemeProvider()->getThemeById($theme);
149+
if ($themeId) {
150+
$params['themeModel'] = $this->getThemeProvider()->getThemeById($themeId);
150151
if (!$params['themeModel']) {
151-
throw new \UnexpectedValueException("Could not find theme '$theme' for area '$area'");
152+
throw new \UnexpectedValueException("Could not find theme '$themeId' for area '$area'");
153+
}
154+
} elseif ($themePath) {
155+
$params['themeModel'] = $this->getThemeProvider()->getThemeByFullPath($area . '/' . $themePath);
156+
if (!$params['themeModel']) {
157+
throw new \UnexpectedValueException("Could not find theme '$themePath' for area '$area'");
152158
}
153159
} elseif (empty($params['themeModel'])) {
154160
$params['themeModel'] = $this->getDefaultParameter('themeModel');

0 commit comments

Comments
 (0)