|
10 | 10 | use Magento\Framework\App\View\Deployment\Version;
|
11 | 11 | use Magento\Framework\App\View\Asset\Publisher;
|
12 | 12 | use Magento\Framework\App\Utility\Files;
|
| 13 | +use Magento\Framework\Config\Theme; |
13 | 14 | use Magento\Framework\ObjectManagerInterface;
|
14 | 15 | use Magento\Framework\Translate\Js\Config as JsTranslationConfig;
|
15 | 16 | use Symfony\Component\Console\Output\OutputInterface;
|
@@ -95,6 +96,7 @@ public function __construct(
|
95 | 96 | $this->isDryRun = $isDryRun;
|
96 | 97 | $this->minifyService = $minifyService;
|
97 | 98 | $this->jsTranslationConfig = $jsTranslationConfig;
|
| 99 | + $this->parentTheme = []; |
98 | 100 | }
|
99 | 101 |
|
100 | 102 | /**
|
@@ -125,8 +127,14 @@ public function deploy(ObjectManagerFactory $omFactory, array $locales)
|
125 | 127 | $this->count = 0;
|
126 | 128 | $this->errorCount = 0;
|
127 | 129 | foreach ($appFiles as $info) {
|
128 |
| - list($fileArea, , , $module, $filePath) = $info; |
129 |
| - if ($fileArea == $area || $fileArea == 'base') { |
| 130 | + list($fileArea, $fileTheme, , $module, $filePath) = $info; |
| 131 | + if (($fileArea == $area || $fileArea == 'base') && |
| 132 | + ($fileTheme == '' || $fileTheme == $themePath || |
| 133 | + in_array( |
| 134 | + $fileArea . Theme::THEME_PATH_SEPARATOR . $fileTheme, |
| 135 | + $this->findAncestors($area . Theme::THEME_PATH_SEPARATOR . $themePath) |
| 136 | + )) |
| 137 | + ) { |
130 | 138 | $this->deployFile($filePath, $area, $themePath, $locale, $module);
|
131 | 139 | }
|
132 | 140 | }
|
@@ -302,6 +310,25 @@ private function deployFile($filePath, $area, $themePath, $locale, $module)
|
302 | 310 | }
|
303 | 311 | }
|
304 | 312 |
|
| 313 | + /** |
| 314 | + * Find ancestor themes' full paths |
| 315 | + * |
| 316 | + * @param string $themeFullPath |
| 317 | + * @return string[] |
| 318 | + */ |
| 319 | + private function findAncestors($themeFullPath) |
| 320 | + { |
| 321 | + /** @var \Magento\Framework\View\Design\Theme\ListInterface $themeCollection */ |
| 322 | + $themeCollection = $this->objectManager->get('Magento\Framework\View\Design\Theme\ListInterface'); |
| 323 | + $theme = $themeCollection->getThemeByFullPath($themeFullPath); |
| 324 | + $ancestors = $theme->getInheritedThemes(); |
| 325 | + $ancestorThemeFullPath = []; |
| 326 | + foreach ($ancestors as $ancestor) { |
| 327 | + $ancestorThemeFullPath[] = $ancestor->getFullPath(); |
| 328 | + } |
| 329 | + return $ancestorThemeFullPath; |
| 330 | + } |
| 331 | + |
305 | 332 | /**
|
306 | 333 | * Verbose log
|
307 | 334 | *
|
|
0 commit comments