comparison core/lib/Drupal/Core/Extension/ThemeInstaller.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
172 // not check schema when saving the configuration. 172 // not check schema when saving the configuration.
173 $extension_config 173 $extension_config
174 ->set("theme.$key", 0) 174 ->set("theme.$key", 0)
175 ->save(TRUE); 175 ->save(TRUE);
176 176
177 // Add the theme to the current list.
178 // @todo Remove all code that relies on $status property.
179 $theme_data[$key]->status = 1;
180 $this->themeHandler->addTheme($theme_data[$key]);
181
182 // Update the current theme data accordingly.
183 $current_theme_data = $this->state->get('system.theme.data', []);
184 $current_theme_data[$key] = $theme_data[$key];
185 $this->state->set('system.theme.data', $current_theme_data);
186
187 // Reset theme settings. 177 // Reset theme settings.
188 $theme_settings = &drupal_static('theme_get_setting'); 178 $theme_settings = &drupal_static('theme_get_setting');
189 unset($theme_settings[$key]); 179 unset($theme_settings[$key]);
190 180
191 // @todo Remove system_list(). 181 // Reset theme listing.
192 $this->systemListReset(); 182 $this->themeHandler->reset();
193 183
194 // Only install default configuration if this theme has not been installed 184 // Only install default configuration if this theme has not been installed
195 // already. 185 // already.
196 if (!isset($installed_themes[$key])) { 186 if (!isset($installed_themes[$key])) {
197 // Install default configuration of the theme. 187 // Install default configuration of the theme.
243 } 233 }
244 } 234 }
245 } 235 }
246 236
247 $this->cssCollectionOptimizer->deleteAll(); 237 $this->cssCollectionOptimizer->deleteAll();
248 $current_theme_data = $this->state->get('system.theme.data', []);
249 foreach ($theme_list as $key) { 238 foreach ($theme_list as $key) {
250 // The value is not used; the weight is ignored for themes currently. 239 // The value is not used; the weight is ignored for themes currently.
251 $extension_config->clear("theme.$key"); 240 $extension_config->clear("theme.$key");
252 241
253 // Update the current theme data accordingly.
254 unset($current_theme_data[$key]);
255
256 // Reset theme settings. 242 // Reset theme settings.
257 $theme_settings = &drupal_static('theme_get_setting'); 243 $theme_settings = &drupal_static('theme_get_setting');
258 unset($theme_settings[$key]); 244 unset($theme_settings[$key]);
259 245
260 // Remove all configuration belonging to the theme. 246 // Remove all configuration belonging to the theme.
262 248
263 } 249 }
264 // Don't check schema when uninstalling a theme since we are only clearing 250 // Don't check schema when uninstalling a theme since we are only clearing
265 // keys. 251 // keys.
266 $extension_config->save(TRUE); 252 $extension_config->save(TRUE);
267 $this->state->set('system.theme.data', $current_theme_data); 253
268 254 // Refresh theme info.
269 // @todo Remove system_list().
270 $this->themeHandler->refreshInfo();
271 $this->resetSystem(); 255 $this->resetSystem();
256 $this->themeHandler->reset();
272 257
273 $this->moduleHandler->invokeAll('themes_uninstalled', [$theme_list]); 258 $this->moduleHandler->invokeAll('themes_uninstalled', [$theme_list]);
274 } 259 }
275 260
276 /** 261 /**
278 */ 263 */
279 protected function resetSystem() { 264 protected function resetSystem() {
280 if ($this->routeBuilder) { 265 if ($this->routeBuilder) {
281 $this->routeBuilder->setRebuildNeeded(); 266 $this->routeBuilder->setRebuildNeeded();
282 } 267 }
283 $this->systemListReset();
284 268
285 // @todo It feels wrong to have the requirement to clear the local tasks 269 // @todo It feels wrong to have the requirement to clear the local tasks
286 // cache here. 270 // cache here.
287 Cache::invalidateTags(['local_task']); 271 Cache::invalidateTags(['local_task']);
288 $this->themeRegistryRebuild(); 272 $this->themeRegistryRebuild();
293 */ 277 */
294 protected function themeRegistryRebuild() { 278 protected function themeRegistryRebuild() {
295 drupal_theme_rebuild(); 279 drupal_theme_rebuild();
296 } 280 }
297 281
298 /**
299 * Wraps system_list_reset().
300 */
301 protected function systemListReset() {
302 system_list_reset();
303 }
304
305 } 282 }