21 private $themeCollection;
28 private $themeProvider;
35 private $themePackageInfo;
45 ThemeCollection $themeCollection,
49 $this->themeCollection = $themeCollection;
50 $this->themeProvider = $themeProvider;
51 $this->themePackageInfo = $themePackageInfo;
63 foreach ($packages as $package) {
64 $themePath = $this->themePackageInfo->getFullThemePath($package);
66 $themePaths[] = $themePath;
85 $themeHasVirtualChildren = [];
86 $themeHasPhysicalChildren = [];
87 $parentChildMap = $this->getParentChildThemeMap();
88 foreach ($themePaths as $themePath) {
89 $theme = $this->themeProvider->getThemeByFullPath($themePath);
90 if (
$theme->hasChildThemes()) {
91 $themeHasVirtualChildren[] = $themePath;
93 if (isset($parentChildMap[$themePath])) {
94 $themeHasPhysicalChildren[] = $themePath;
97 if (!empty($themeHasVirtualChildren)) {
98 $text = count($themeHasVirtualChildren) > 1 ?
' are parents of' :
' is a parent of';
99 $messages[] = implode(
', ', $themeHasVirtualChildren) .
$text .
' virtual theme.' 100 .
' Parent themes cannot be uninstalled.';
102 if (!empty($themeHasPhysicalChildren)) {
103 $text = count($themeHasPhysicalChildren) > 1 ?
' are parents of' :
' is a parent of';
104 $messages[] = implode(
', ', $themeHasPhysicalChildren) .
$text .
' physical theme.' 105 .
' Parent themes cannot be uninstalled.';
115 private function getParentChildThemeMap()
118 $this->themeCollection->resetConstraints();
119 $this->themeCollection->clear();
121 foreach ($this->themeCollection as
$theme) {
122 if (
$theme->getParentTheme()) {
__construct(ThemeCollection $themeCollection, ThemeProvider $themeProvider, ThemePackageInfo $themePackageInfo)
checkChildThemeByPackagesName($packages)
checkChildTheme($themePaths)