comparison core/lib/Drupal/Core/Extension/ThemeInstaller.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
5 use Drupal\Core\Asset\AssetCollectionOptimizerInterface; 5 use Drupal\Core\Asset\AssetCollectionOptimizerInterface;
6 use Drupal\Core\Cache\Cache; 6 use Drupal\Core\Cache\Cache;
7 use Drupal\Core\Config\ConfigFactoryInterface; 7 use Drupal\Core\Config\ConfigFactoryInterface;
8 use Drupal\Core\Config\ConfigInstallerInterface; 8 use Drupal\Core\Config\ConfigInstallerInterface;
9 use Drupal\Core\Config\ConfigManagerInterface; 9 use Drupal\Core\Config\ConfigManagerInterface;
10 use Drupal\Core\Extension\Exception\UnknownExtensionException;
10 use Drupal\Core\Routing\RouteBuilderInterface; 11 use Drupal\Core\Routing\RouteBuilderInterface;
11 use Drupal\Core\State\StateInterface; 12 use Drupal\Core\State\StateInterface;
12 use Psr\Log\LoggerInterface; 13 use Psr\Log\LoggerInterface;
13 14
14 /** 15 /**
109 if ($install_dependencies) { 110 if ($install_dependencies) {
110 $theme_list = array_combine($theme_list, $theme_list); 111 $theme_list = array_combine($theme_list, $theme_list);
111 112
112 if ($missing = array_diff_key($theme_list, $theme_data)) { 113 if ($missing = array_diff_key($theme_list, $theme_data)) {
113 // One or more of the given themes doesn't exist. 114 // One or more of the given themes doesn't exist.
114 throw new \InvalidArgumentException('Unknown themes: ' . implode(', ', $missing) . '.'); 115 throw new UnknownExtensionException('Unknown themes: ' . implode(', ', $missing) . '.');
115 } 116 }
116 117
117 // Only process themes that are not installed currently. 118 // Only process themes that are not installed currently.
118 $installed_themes = $extension_config->get('theme') ?: []; 119 $installed_themes = $extension_config->get('theme') ?: [];
119 if (!$theme_list = array_diff_key($theme_list, $installed_themes)) { 120 if (!$theme_list = array_diff_key($theme_list, $installed_themes)) {
219 $extension_config = $this->configFactory->getEditable('core.extension'); 220 $extension_config = $this->configFactory->getEditable('core.extension');
220 $theme_config = $this->configFactory->getEditable('system.theme'); 221 $theme_config = $this->configFactory->getEditable('system.theme');
221 $list = $this->themeHandler->listInfo(); 222 $list = $this->themeHandler->listInfo();
222 foreach ($theme_list as $key) { 223 foreach ($theme_list as $key) {
223 if (!isset($list[$key])) { 224 if (!isset($list[$key])) {
224 throw new \InvalidArgumentException("Unknown theme: $key."); 225 throw new UnknownExtensionException("Unknown theme: $key.");
225 } 226 }
226 if ($key === $theme_config->get('default')) { 227 if ($key === $theme_config->get('default')) {
227 throw new \InvalidArgumentException("The current default theme $key cannot be uninstalled."); 228 throw new \InvalidArgumentException("The current default theme $key cannot be uninstalled.");
228 } 229 }
229 if ($key === $theme_config->get('admin')) { 230 if ($key === $theme_config->get('admin')) {