core/modules/system/src/Form/ThemeSettingsForm.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/modules/system/src/Form/ThemeSettingsForm.php b/core/modules/system/src/Form/ThemeSettingsForm.php index f5cfb09..3220b3e 100644 --- a/core/modules/system/src/Form/ThemeSettingsForm.php +++ b/core/modules/system/src/Form/ThemeSettingsForm.php @@ -113,7 +113,6 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = $themes = $this->themeHandler->listInfo(); - // Default settings are defined in theme_get_setting() in includes/theme.inc if ($theme) { if (!$this->themeHandler->hasUi($theme)) { throw new NotFoundHttpException(); @@ -127,10 +126,8 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = $var = 'theme_settings'; $config_key = 'system.theme.global'; } - // @todo this is pretty meaningless since we're using theme_get_settings - // which means overrides can bleed into active config here. Will be fixed - // by https://www.drupal.org/node/2402467. $this->editableConfig = [$config_key]; + $theme_config = $this->config($config_key); $form['var'] = [ '#type' => 'hidden', @@ -167,7 +164,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = ]; foreach ($toggles as $name => $title) { if ((!$theme) || in_array($name, $features)) { - $form['theme_settings']['toggle_' . $name] = ['#type' => 'checkbox', '#title' => $title, '#default_value' => theme_get_setting('features.' . $name, $theme)]; + $form['theme_settings']['toggle_' . $name] = ['#type' => 'checkbox', '#title' => $title, '#default_value' => $theme_config->get('features.' . $name)]; // Disable checkboxes for features not supported in the current configuration. if (isset($disabled['toggle_' . $name])) { $form['theme_settings']['toggle_' . $name]['#disabled'] = TRUE; @@ -191,7 +188,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = $form['logo']['default_logo'] = [ '#type' => 'checkbox', '#title' => t('Use the logo supplied by the theme'), - '#default_value' => theme_get_setting('logo.use_default', $theme), + '#default_value' => $theme_config->get('logo.use_default'), '#tree' => FALSE, ]; $form['logo']['settings'] = [ @@ -206,7 +203,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = $form['logo']['settings']['logo_path'] = [ '#type' => 'textfield', '#title' => t('Path to custom logo'), - '#default_value' => theme_get_setting('logo.path', $theme), + '#default_value' => $theme_config->get('logo.path'), ]; $form['logo']['settings']['logo_upload'] = [ '#type' => 'file', @@ -233,7 +230,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = $form['favicon']['default_favicon'] = [ '#type' => 'checkbox', '#title' => t('Use the favicon supplied by the theme'), - '#default_value' => theme_get_setting('favicon.use_default', $theme), + '#default_value' => $theme_config->get('favicon.use_default'), ]; $form['favicon']['settings'] = [ '#type' => 'container', @@ -247,7 +244,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = $form['favicon']['settings']['favicon_path'] = [ '#type' => 'textfield', '#title' => t('Path to custom icon'), - '#default_value' => theme_get_setting('favicon.path', $theme), + '#default_value' => $theme_config->get('favicon.path'), ]; $form['favicon']['settings']['favicon_upload'] = [ '#type' => 'file',