From 77f8dc525d9faa55aee60d777b5d665e99b8a7ba Mon Sep 17 00:00:00 2001 From: Dries Date: Sat, 10 May 2014 09:58:21 -0500 Subject: [PATCH] Issue #2263201 by alexpott: ConfigImportUITest has a random failure. --- core/lib/Drupal/Core/Extension/ThemeHandler.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index 25784cab73..dbe2c78dca 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -133,10 +133,8 @@ public function getDefault() { * {@inheritdoc} */ public function setDefault($name) { - if (!isset($this->list)) { - $this->listInfo(); - } - if (!isset($this->list[$name])) { + $list = $this->listInfo(); + if (!isset($list[$name])) { throw new \InvalidArgumentException("$name theme is not enabled."); } $this->configFactory->get('system.theme') @@ -275,10 +273,11 @@ public function enable(array $theme_list, $enable_dependencies = TRUE) { * {@inheritdoc} */ public function disable(array $theme_list) { + $list = $this->listInfo(); $theme_config = $this->configFactory->get('system.theme'); foreach ($theme_list as $key) { - if (!isset($this->list[$key])) { + if (!isset($list[$key])) { throw new \InvalidArgumentException("Unknown theme: $key."); } if ($key === $theme_config->get('default')) { @@ -289,9 +288,9 @@ public function disable(array $theme_list) { } // Base themes cannot be disabled if sub themes are enabled, and if they // are not disabled at the same time. - if (!empty($this->list[$key]->sub_themes)) { - foreach ($this->list[$key]->sub_themes as $sub_key => $sub_label) { - if (isset($this->list[$sub_key]) && !in_array($sub_key, $theme_list, TRUE)) { + if (!empty($list[$key]->sub_themes)) { + foreach ($list[$key]->sub_themes as $sub_key => $sub_label) { + if (isset($list[$sub_key]) && !in_array($sub_key, $theme_list, TRUE)) { throw new \InvalidArgumentException("The base theme $key cannot be disabled, because theme $sub_key depends on it."); } } -- GitLab