Commit 77f8dc52 authored by Dries's avatar Dries

Issue #2263201 by alexpott: ConfigImportUITest has a random failure.

parent af56f3c3
......@@ -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.");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment