diff -u b/core/includes/theme.inc b/core/includes/theme.inc --- b/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -9,6 +9,7 @@ */ use Drupal\Core\Utility\ThemeRegistry; +use Drupal\Component\Utility\NestedArray; /** * @defgroup content_flags Content markers @@ -1315,7 +1316,7 @@ ), 'logo' => array('use_default' => 1), ); - $default_config += $config->get(); + $default_config = NestedArray::mergeDeep($default_config, $config->get()); // Cache a config object that will merge $default_config, // system.theme configuration and the theme's config. $cache[$theme] = clone $config; @@ -1338,12 +1339,12 @@ foreach ($theme_keys as $theme_key) { // @todo Need to work how to convert this to CMI. if (!empty($themes[$theme_key]->info['settings'])) { - $cache[$theme]->setData(array_merge_recursive($cache[$theme]->get(), $themes[$theme_key]->info['settings'])); + $cache[$theme]->setData(NestedArray::mergeDeep($cache[$theme]->get(), $themes[$theme_key]->info['settings'])); } } // Get the saved theme-specific settings from the configuration system. - $cache[$theme]->setData(array_merge_recursive($cache[$theme]->get(), config($theme . '.settings')->get())); + $cache[$theme]->setData(NestedArray::mergeDeep($cache[$theme]->get(), config($theme . '.settings')->get())); // If the theme does not support a particular feature, override the global // setting and set the value to NULL. @@ -1357,16 +1358,18 @@ // Generate the path to the logo image. if ($cache[$theme]->get('features.logo')) { + $logo_path = $cache[$theme]->get('logo.path'); if ($cache[$theme]->get('logo.use_default')) { $cache[$theme]->set('logo.url', file_create_url(dirname($theme_object->filename) . '/logo.png')); } - elseif ($cache[$theme]->get('logo.logo_path')) { - $cache[$theme]->set('logo.url', file_create_url($cache[$theme]['logo']['logo_path'])); + elseif ($logo_path) { + $cache[$theme]->set('logo.url', file_create_url($logo_path)); } } // Generate the path to the favicon. if ($cache[$theme]->get('features.favicon')) { + $favicon_path = $cache[$theme]->get('favicon.path'); if ($cache[$theme]->get('favicon.use_default')) { if (file_exists($favicon = dirname($theme_object->filename) . '/favicon.ico')) { $cache[$theme]->set('favicon.url', file_create_url($favicon)); @@ -1375,8 +1378,8 @@ $cache[$theme]->set('favicon.url', file_create_url('core/misc/favicon.ico')); } } - elseif ($cache[$theme]->get('favicon.path')) { - $cache[$theme]->set('favicon.url', file_create_url($cache[$theme]['favicon_path'])); + elseif ($favicon_path) { + $cache[$theme]->set('favicon.url', file_create_url($favicon_path)); } else { $cache[$theme]->set('features.favicon', FALSE); @@ -1424,9 +1427,9 @@ $new_config['favicon']['mimetype'] = $value; } else if (substr($key, 0, 7) == 'toggle_') { - $new_config['features'][substr($key, 7)] = (bool) $value; + $new_config['features'][substr($key, 7)] = $value; } - else if (!in_array($key, array('theme'))) { + else if (!in_array($key, array('theme', 'logo_upload'))) { $new_config[$key] = $value; } } diff -u b/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc --- b/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -8,6 +8,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Drupal\Component\Utility\NestedArray; /** * Menu callback; Provide the administration overview page. @@ -442,7 +443,7 @@ $form['logo']['default_logo'] = array( '#type' => 'checkbox', '#title' => t('Use the default logo supplied by the theme'), - '#default_value' => theme_get_setting('features.logo', $key), + '#default_value' => theme_get_setting('logo.use_default', $key), '#tree' => FALSE, ); $form['logo']['settings'] = array( @@ -476,7 +477,7 @@ $form['favicon']['default_favicon'] = array( '#type' => 'checkbox', '#title' => t('Use the default shortcut icon supplied by the theme'), - '#default_value' => theme_get_setting('features.favicon', $key), + '#default_value' => theme_get_setting('favicon.use_default', $key), ); $form['favicon']['settings'] = array( '#type' => 'container', @@ -717,11 +718,10 @@ $values['favicon_mimetype'] = file_get_mimetype($values['favicon_path']); } - $new_config = theme_convert_variables_to_config($values); - foreach ($new_config as $key => $value) { - $config->set($key, $value)->save(); - } - + // Merge form values into theme's configuration data in case there is + // configuration not exposed on system_theme_settings(). + $new_config = theme_convert_variables_to_config($values); + $config->setData(NestedArray::mergeDeep($config->get(), $new_config))->save(); cache_invalidate(array('content' => TRUE)); }