diff -u b/core/includes/theme.inc b/core/includes/theme.inc --- b/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1290,7 +1290,6 @@ function theme_get_setting($setting_name, $theme = NULL) { $cache = &drupal_static(__FUNCTION__, array()); - $global_config = config('system.theme'); // If no key is given, use the current theme if we can determine it. if (!isset($theme)) { @@ -1299,7 +1298,23 @@ if (empty($cache[$theme])) { // Set the default values for each global setting. - $cache[$theme] = theme_config_convert_newold($global_config->get()); + $default_config = array( + 'favicon' => array('use_default' => 1), + 'features' => array( + 'comment_user_picture' => 1, + 'comment_user_verification' => 1, + 'favicon' => 1, + 'logo' => 1, + 'name' => 1, + 'node_user_picture' => 1, + 'main_menu' => 1, + 'secondary_menu' => 1, + 'slogan' => 1, + ), + 'logo' => array('use_default' => 1), + ); + $default_config += config('system.theme')->get(); + $cache[$theme] = theme_config_convert_newold($default_config); // Get the values for the theme-specific settings from the .info files of // the theme and all its base themes. @@ -1326,9 +1341,8 @@ // If the theme does not support a particular feature, override the global // setting and set the value to NULL. - $features = $global_config->get('features'); - if (!empty($features) and !empty($theme_object->info['features'])) { - foreach ($features as $feature) { + if (!empty($theme_object->info['features'])) { + foreach ($default_config['features'] as $feature) { if (!in_array($feature, $theme_object->info['features'])) { $cache[$theme]['toggle_' . $feature] = NULL; } @@ -1382,25 +1396,31 @@ $new_config = array(); foreach ($old_config as $key => $value) { - if ($key == 'default_logo' && !empty($value)) { - $new_config['logo']['use_default'] = (bool) $value; + if ($key == 'logo') { + $new_config['logo']['url'] = $value; } - else if ($key == 'logo_path' && !empty($value)) { + else if ($key == 'default_logo') { + $new_config['logo']['use_default'] = $value; + } + else if ($key == 'logo_path') { $new_config['logo']['path'] = $value; } - else if ($key == 'default_favicon' && !empty($value)) { - $new_config['favicon']['use_default'] = (bool) $value; + else if ($key == 'favicon') { + $new_config['favicon']['url'] = $value; + } + else if ($key == 'default_favicon') { + $new_config['favicon']['use_default'] = $value; } - else if ($key == 'favicon_path' && !empty($value)) { + else if ($key == 'favicon_path') { $new_config['favicon']['path'] = $value; } - else if ($key == 'favicon_mimetype' && !empty($value)) { + else if ($key == 'favicon_mimetype') { $new_config['favicon']['mimetype'] = $value; } - else if (substr($key, 0, 7) == 'toggle_' && !empty($value)) { + else if (substr($key, 0, 7) == 'toggle_') { $new_config['features'][substr($key, 7)] = (bool) $value; } - else if (!empty($value)) { + else if (!in_array($key, array('theme'))) { $new_config[$key] = $value; } } @@ -1423,6 +1443,7 @@ foreach ($new_config as $key => $value) { if (in_array($key, array('logo', 'favicon'))) { + if (isset($value['use_default'])) { $old_config['default_' . $key] = $value['use_default']; } @@ -1431,6 +1452,10 @@ $old_config[$key . '_path'] = $value['path']; } + if (isset($value['url'])) { + $old_config[$key] = $value['url']; + } + if ($key == 'favicon' && isset($value['mimetype'])) { $old_config['favicon_mimetype'] = $value['mimetype']; } @@ -1483,9 +1508,6 @@ ->condition('type', 'theme') ->condition('name', $key) ->execute(); - - // Install default configuration of the theme. - config_install_default_config('theme', $key); } list_themes(TRUE); diff -u b/core/modules/system/config/system.theme.yml b/core/modules/system/config/system.theme.yml --- b/core/modules/system/config/system.theme.yml +++ b/core/modules/system/config/system.theme.yml @@ -1,6 +1,7 @@ favicon: mimetype: image/vnd.microsoft.icon path: '' + url: '' use_default: '1' features: comment_user_picture: '1' @@ -16,2 +17,3 @@ path: '' + url: '' use_default: '1' diff -u b/core/modules/system/system.install b/core/modules/system/system.install --- b/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2004,11 +2004,11 @@ $variables = array('theme_settings' => 'system.theme'); $themes = list_themes(); foreach ($themes as $theme) { - $variables['theme_' . $theme->name . '_settings'] = $theme->name . '_settings'; + $variables['theme_' . $theme->name . '_settings'] = $theme->name . '.settings'; } foreach ($variables as $old_key => $new_key) { - $config = theme_config_convert_oldnew(variable_get($old_key)); + $config = theme_config_convert_oldnew(variable_get($old_key, array())); $new_config = config($new_key); foreach ($config as $key => $value) { $new_config->set($key, $value);