diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index 026d630..7636d18 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -411,7 +411,7 @@ function ajax_base_page_theme() { // to see the default theme, token validation isn't required for that, and // bypassing it allows most use-cases to work even when accessed from the // page cache. - if ($theme === variable_get('theme_default', 'stark') || drupal_valid_token($token, $theme)) { + if ($theme === config('system.theme')->get('default') || drupal_valid_token($token, $theme)) { return $theme; } } diff --git a/core/includes/config.inc b/core/includes/config.inc index c143dd4..5b1fe21 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -12,22 +12,24 @@ use Drupal\Core\Config\StorageInterface; */ /** - * Installs the default configuration of a given module. + * Installs the default configuration of a given extension. * - * @param - * The name of the module we are installing. + * @param string $type + * The extension type; e.g., 'module' or 'theme'. + * @param string $name + * The name of the module or theme to install default configuration for. * * @todo Make this acknowledge other storage engines rather than having * SQL be hardcoded. */ -function config_install_default_config($module) { - $module_config_dir = drupal_get_path('module', $module) . '/config'; - if (is_dir($module_config_dir)) { - $source_storage = new FileStorage(array('directory' => $module_config_dir)); +function config_install_default_config($type, $name) { + $config_dir = drupal_get_path($type, $name) . '/config'; + if (is_dir($config_dir)) { + $source_storage = new FileStorage(array('directory' => $config_dir)); $target_storage = new DatabaseStorage(); $null_storage = new NullStorage(); - // Upon module installation, only new config objects need to be created. + // Upon installation, only new config objects need to be created. // config_sync_get_changes() would potentially perform a diff of hundreds or // even thousands of config objects that happen to be contained in the // active store. We leverage the NullStorage to avoid that needless diff --git a/core/includes/install.inc b/core/includes/install.inc index 91e10a1..c3c91d8 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -387,7 +387,7 @@ function drupal_install_system() { system_rebuild_module_data(); system_rebuild_theme_data(); - config_install_default_config('system'); + config_install_default_config('module', 'system'); module_invoke('system', 'install'); } diff --git a/core/includes/module.inc b/core/includes/module.inc index 0f0f705..ab45576 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -462,7 +462,7 @@ function module_enable($module_list, $enable_dependencies = TRUE) { $version = $versions ? max($versions) : SCHEMA_INSTALLED; // Install default configuration of the module. - config_install_default_config($module); + config_install_default_config('module', $module); // If the module has no current updates, but has some that were // previously removed, set the version to the value of diff --git a/core/includes/theme.inc b/core/includes/theme.inc index d75fbd7..bb51946 100644 --- a/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 @@ -62,7 +63,7 @@ function drupal_theme_access($theme) { * @see drupal_theme_access() */ function _drupal_theme_access($theme) { - $admin_theme = variable_get('admin_theme'); + $admin_theme = config('system.theme')->get('admin'); return !empty($theme->status) || ($admin_theme && $theme->name == $admin_theme); } @@ -82,7 +83,7 @@ function drupal_theme_initialize() { // Only select the user selected theme if it is available in the // list of themes that can be accessed. - $theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : variable_get('theme_default', 'stark'); + $theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : config('system.theme')->get('default'); // Allow modules to override the theme. Validation has already been performed // inside menu_get_custom_theme(), so we do not need to check it again here. @@ -659,7 +660,7 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) { * their base theme), direct sub-themes of sub-themes, etc. The keys are * the themes' machine names, and the values are the themes' human-readable * names. This element is not set if there are no themes on the system that - * declare this theme as their base theme. + * declare this theme as their base theme. */ function list_themes($refresh = FALSE) { $list = &drupal_static(__FUNCTION__, array()); @@ -1287,6 +1288,7 @@ function drupal_find_theme_templates($cache, $extension, $path) { * @return * The value of the requested setting, NULL if the setting does not exist. */ + function theme_get_setting($setting_name, $theme = NULL) { $cache = &drupal_static(__FUNCTION__, array()); @@ -1296,23 +1298,31 @@ function theme_get_setting($setting_name, $theme = NULL) { } if (empty($cache[$theme])) { - // Set the default values for each global setting. - // To add new global settings, add their default values below, and then - // add form elements to system_theme_settings() in system.admin.inc. - $cache[$theme] = array( - 'default_logo' => 1, - 'logo_path' => '', - 'default_favicon' => 1, - 'favicon_path' => '', - // Use the IANA-registered MIME type for ICO files as default. - 'favicon_mimetype' => 'image/vnd.microsoft.icon', + // Provide defaults as function is used before config installed. + $default_config = array( + 'favicon' => array( + 'path' => '', + // Use the IANA-registered MIME type for ICO files as default. + 'mimetype' => 'image/vnd.microsoft.icon', + 'use_default' => 1, + ), + 'features' => array(), + 'logo' => array( + 'path' => '', + 'use_default' => 1, + ), ); // Turn on all default features. $features = _system_default_theme_features(); foreach ($features as $feature) { - $cache[$theme]['toggle_' . $feature] = 1; + $default_config['features'][$feature] = 1; } + // Cache a config object that will merge $default_config, + // system.theme configuration and the theme's config. + $cache[$theme] = config('cache.' . $theme); + $cache[$theme]->setData($default_config); + // Get the values for the theme-specific settings from the .info files of // the theme and all its base themes. if ($theme) { @@ -1329,59 +1339,107 @@ function theme_get_setting($setting_name, $theme = NULL) { } foreach ($theme_keys as $theme_key) { if (!empty($themes[$theme_key]->info['settings'])) { - $cache[$theme] = array_merge($cache[$theme], $themes[$theme_key]->info['settings']); + $cache[$theme]->setData(NestedArray::mergeDeep($cache[$theme]->get(), $themes[$theme_key]->info['settings'])); } } } // Get the saved global settings from the database. - $cache[$theme] = array_merge($cache[$theme], variable_get('theme_settings', array())); + $cache[$theme]->setData(NestedArray::mergeDeep($cache[$theme]->get(), config('system.theme.global')->get())); if ($theme) { - // Get the saved theme-specific settings from the database. - $cache[$theme] = array_merge($cache[$theme], variable_get('theme_' . $theme . '_settings', array())); + // Get the saved theme-specific settings from the configuration system. + $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. if (!empty($theme_object->info['features'])) { - foreach ($features as $feature) { + foreach ($default_config['features'] as $feature => $enabled) { if (!in_array($feature, $theme_object->info['features'])) { - $cache[$theme]['toggle_' . $feature] = NULL; + $cache[$theme]->set('features.' . $feature, NULL); } } } // Generate the path to the logo image. - if ($cache[$theme]['toggle_logo']) { - if ($cache[$theme]['default_logo']) { - $cache[$theme]['logo'] = file_create_url(dirname($theme_object->filename) . '/logo.png'); + 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]['logo_path']) { - $cache[$theme]['logo'] = file_create_url($cache[$theme]['logo_path']); + elseif ($logo_path) { + $cache[$theme]->set('logo.url', file_create_url($logo_path)); } } // Generate the path to the favicon. - if ($cache[$theme]['toggle_favicon']) { - if ($cache[$theme]['default_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]['favicon'] = file_create_url($favicon); + $cache[$theme]->set('favicon.url', file_create_url($favicon)); } else { - $cache[$theme]['favicon'] = file_create_url('core/misc/favicon.ico'); + $cache[$theme]->set('favicon.url', file_create_url('core/misc/favicon.ico')); } } - elseif ($cache[$theme]['favicon_path']) { - $cache[$theme]['favicon'] = file_create_url($cache[$theme]['favicon_path']); + elseif ($favicon_path) { + $cache[$theme]->set('favicon.url', file_create_url($favicon_path)); } else { - $cache[$theme]['toggle_favicon'] = FALSE; + $cache[$theme]->set('features.favicon', FALSE); } } } } - return isset($cache[$theme][$setting_name]) ? $cache[$theme][$setting_name] : NULL; + return $cache[$theme]->get($setting_name); +} + +/** + * Converts format of old theme-configuration to the format of yml-configuration. + * + * @param $old_config + * The configuration loaded from old theme configuration + * @return + * Configuration array compatible to yml-configuration + * + * @todo Make this function obsolete + */ +function theme_convert_variables_to_config($old_config) { + $new_config = array(); + + foreach ($old_config as $key => $value) { + if ($key == 'logo') { + $new_config['logo']['url'] = $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 == 'favicon') { + $new_config['favicon']['url'] = $value; + } + else if ($key == 'default_favicon') { + $new_config['favicon']['use_default'] = $value; + } + else if ($key == 'favicon_path') { + $new_config['favicon']['path'] = $value; + } + else if ($key == 'favicon_mimetype') { + $new_config['favicon']['mimetype'] = $value; + } + else if (substr($key, 0, 7) == 'toggle_') { + $new_config['features'][substr($key, 7)] = $value; + } + else if (!in_array($key, array('theme', 'logo_upload'))) { + $new_config[$key] = $value; + } + } + + return $new_config; } /** @@ -1435,7 +1493,7 @@ function theme_enable($theme_list) { */ function theme_disable($theme_list) { // Don't disable the default theme. - if ($pos = array_search(variable_get('theme_default', 'stark'), $theme_list) !== FALSE) { + if ($pos = array_search(config('system.theme')->get('default'), $theme_list) !== FALSE) { unset($theme_list[$pos]); if (empty($theme_list)) { return; @@ -2445,9 +2503,9 @@ function template_preprocess_html(&$variables) { $variables['html_attributes']['dir'] = $language_interface->direction ? 'rtl' : 'ltr'; // Add favicon. - if (theme_get_setting('toggle_favicon')) { - $favicon = theme_get_setting('favicon'); - $type = theme_get_setting('favicon_mimetype'); + if (theme_get_setting('features.favicon')) { + $favicon = theme_get_setting('favicon.url'); + $type = theme_get_setting('favicon.mimetype'); drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type)); } @@ -2553,12 +2611,12 @@ function template_preprocess_page(&$variables) { $variables['feed_icons'] = drupal_get_feeds(); $variables['language'] = $language_interface; $variables['language']->dir = $language_interface->direction ? 'rtl' : 'ltr'; - $variables['logo'] = theme_get_setting('logo'); - $variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array(); - $variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array(); + $variables['logo'] = theme_get_setting('logo.url'); + $variables['main_menu'] = theme_get_setting('features.main_menu') ? menu_main_menu() : array(); + $variables['secondary_menu'] = theme_get_setting('features.secondary_menu') ? menu_secondary_menu() : array(); $variables['action_links'] = menu_local_actions(); - $variables['site_name'] = (theme_get_setting('toggle_name') ? check_plain($site_config->get('name')) : ''); - $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? filter_xss_admin($site_config->get('slogan')) : ''); + $variables['site_name'] = (theme_get_setting('features.name') ? check_plain($site_config->get('name')) : ''); + $variables['site_slogan'] = (theme_get_setting('features.slogan') ? filter_xss_admin($site_config->get('slogan')) : ''); $variables['tabs'] = menu_local_tabs(); if ($node = menu_get_object()) { @@ -2714,9 +2772,9 @@ function template_preprocess_maintenance_page(&$variables) { $regions = $theme_data[$theme]->info['regions']; // Add favicon - if (theme_get_setting('toggle_favicon')) { - $favicon = theme_get_setting('favicon'); - $type = theme_get_setting('favicon_mimetype'); + if (theme_get_setting('features.favicon')) { + $favicon = theme_get_setting('favicon.url'); + $type = theme_get_setting('favicon.mimetype'); drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type)); } @@ -2763,12 +2821,12 @@ function template_preprocess_maintenance_page(&$variables) { $variables['help'] = ''; $variables['language'] = $language_interface; $variables['language']->dir = $language_interface->direction ? 'rtl' : 'ltr'; - $variables['logo'] = theme_get_setting('logo'); + $variables['logo'] = theme_get_setting('logo.url'); $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; $variables['main_menu'] = array(); $variables['secondary_menu'] = array(); - $variables['site_name'] = (theme_get_setting('toggle_name') ? check_plain($site_name) : ''); - $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? filter_xss_admin($site_slogan) : ''); + $variables['site_name'] = (theme_get_setting('features.name') ? check_plain($site_name) : ''); + $variables['site_slogan'] = (theme_get_setting('features.slogan') ? filter_xss_admin($site_slogan) : ''); $variables['tabs'] = ''; $variables['title'] = drupal_get_title(); diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 52b6c40..cbb0c42 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -50,7 +50,11 @@ function _drupal_maintenance_theme() { // Stark otherwise. Since there is no low-level access to configuration // currently, we only consult settings.php and fall back to Bartik // otherwise, as it looks generic enough and way more user-friendly. - $custom_theme = variable_get('maintenance_theme', variable_get('theme_default', 'bartik')); + $config = config('system.theme'); + $custom_theme = $config->get('maintenance'); + if (empty($custom_theme)) { + $custom_theme = $config->get('default'); + } } // Ensure that system.module is loaded. diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc index aa018da..d5a8013 100644 --- a/core/modules/block/block.admin.inc +++ b/core/modules/block/block.admin.inc @@ -307,8 +307,9 @@ function block_admin_configure($form, &$form_state, $module, $delta) { '#tree' => TRUE, ); - $theme_default = variable_get('theme_default', 'stark'); - $admin_theme = variable_get('admin_theme'); + $config = config('system.theme'); + $theme_default = $config->get('default'); + $admin_theme = $config->get('admin'); foreach (list_themes() as $key => $theme) { // Only display enabled themes if ($theme->status) { diff --git a/core/modules/block/block.module b/core/modules/block/block.module index db80556..15cd3fa 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -63,7 +63,7 @@ function block_help($path, $arg) { return '

' . t('Use this page to create a new custom block.') . '

'; } if ($arg[0] == 'admin' && $arg[1] == 'structure' && $arg['2'] == 'block' && (empty($arg[3]) || $arg[3] == 'list')) { - $demo_theme = !empty($arg[4]) ? $arg[4] : variable_get('theme_default', 'stark'); + $demo_theme = !empty($arg[4]) ? $arg[4] : config('system.theme')->get('default'); $themes = list_themes(); $output = '

' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the Save blocks button at the bottom of the page. Click the configure link next to each block to configure its specific title and visibility settings.') . '

'; $output .= '

' . l(t('Demonstrate block regions (@theme)', array('@theme' => $themes[$demo_theme]->info['name'])), 'admin/structure/block/demo/' . $demo_theme) . '

'; @@ -103,7 +103,7 @@ function block_permission() { * Implements hook_menu(). */ function block_menu() { - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); $items['admin/structure/block'] = array( 'title' => 'Blocks', 'description' => 'Configure what block content appears in your site\'s sidebars and other regions.', @@ -306,7 +306,7 @@ function block_page_build(&$page) { $page['page_top']['backlink'] = array( '#type' => 'link', '#title' => t('Exit block region demonstration'), - '#href' => 'admin/structure/block' . (variable_get('theme_default', 'stark') == $theme ? '' : '/list/' . $theme), + '#href' => 'admin/structure/block' . (config('system.theme')->get('default') == $theme ? '' : '/list/' . $theme), // Add the "overlay-restore" class to indicate this link should restore // the context in which the region demonstration page was opened. '#options' => array('attributes' => array('class' => array('block-demo-backlink', 'overlay-restore'))), @@ -674,7 +674,7 @@ function block_theme_initialize($theme) { // Initialize theme's blocks if none already registered. $has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', 0, 1, array(':theme' => $theme))->fetchField(); if (!$has_blocks) { - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); // Apply only to new theme's visible regions. $regions = system_region_list($theme, REGIONS_VISIBLE); $result = db_query("SELECT * FROM {block} WHERE theme = :theme", array(':theme' => $default_theme), array('fetch' => PDO::FETCH_ASSOC)); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php index 0c3186c..d0bf309 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php @@ -29,7 +29,7 @@ class BlockHiddenRegionTest extends WebTestBase { ->key(array( 'module' => 'search', 'delta' => 'form', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => config('system.theme')->get('default'), )) ->fields(array( 'status' => 1, @@ -56,7 +56,7 @@ class BlockHiddenRegionTest extends WebTestBase { // Enable "block_test_theme" and set it as the default theme. $theme = 'block_test_theme'; theme_enable(array($theme)); - variable_set('theme_default', $theme); + config('system.theme')->set('default', $theme)->save(); menu_router_rebuild(); // Ensure that "block_test_theme" is set as the default theme. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php index 8882b64..cf9fcee 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php @@ -32,12 +32,13 @@ class BlockInvalidRegionTest extends WebTestBase { * Tests that blocks assigned to invalid regions work correctly. */ function testBlockInInvalidRegion() { + $config = config('system.theme'); // Enable a test block in the default theme and place it in an invalid region. db_merge('block') ->key(array( 'module' => 'block_test', 'delta' => 'test_html_id', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => $config->get('default'), )) ->fields(array( 'status' => 1, @@ -61,7 +62,7 @@ class BlockInvalidRegionTest extends WebTestBase { ->key(array( 'module' => 'block_test', 'delta' => 'test_html_id', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => $config->get('default'), )) ->fields(array( 'region' => 'invalid_region', diff --git a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php index b17e601..a9f5eba 100644 --- a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php @@ -35,8 +35,9 @@ class NewDefaultThemeBlocksTest extends WebTestBase { // Ensure no other theme's blocks are in the block table yet. $themes = array(); - $themes['default'] = variable_get('theme_default', 'stark'); - if ($admin_theme = variable_get('admin_theme')) { + $config = config('system.theme'); + $themes['default'] = $config->get('default'); + if ($admin_theme = $config->get('admin')) { $themes['admin'] = $admin_theme; } $count = db_query_range('SELECT 1 FROM {block} WHERE theme NOT IN (:themes)', 0, 1, array(':themes' => $themes))->fetchField(); @@ -55,7 +56,7 @@ class NewDefaultThemeBlocksTest extends WebTestBase { // the default theme had. $new_theme = 'bartik'; theme_enable(array($new_theme)); - variable_set('theme_default', $new_theme); + config('system.theme')->set('default', $new_theme)->save(); $result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => $new_theme)); foreach ($result as $block) { unset($block->theme, $block->bid); diff --git a/core/modules/color/lib/Drupal/color/Tests/ColorTest.php b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php index 3bc95d3..5ba4a1e 100644 --- a/core/modules/color/lib/Drupal/color/Tests/ColorTest.php +++ b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php @@ -68,7 +68,7 @@ class ColorTest extends WebTestBase { * Tests the Color module functionality using the given theme. */ function _testColor($theme, $test_values) { - variable_set('theme_default', $theme); + config('system.theme')->set('default', $theme)->save(); $settings_path = 'admin/appearance/settings/' . $theme; $this->drupalLogin($this->big_user); @@ -114,7 +114,7 @@ class ColorTest extends WebTestBase { * Tests whether the provided color is valid. */ function testValidColor() { - variable_set('theme_default', 'bartik'); + config('system.theme')->set('default', 'bartik')->save(); $settings_path = 'admin/appearance/settings/bartik'; $this->drupalLogin($this->big_user); diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index dfa156d..ee7d0f2 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -2130,7 +2130,7 @@ function template_preprocess_comment(&$variables) { $variables['changed'] = format_date($comment->changed); $variables['new'] = !empty($comment->new) ? t('new') : ''; - $variables['user_picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $comment)) : ''; + $variables['user_picture'] = theme_get_setting('features.comment_user_picture') ? theme('user_picture', array('account' => $comment)) : ''; $variables['signature'] = $comment->signature; $uri = entity_uri('comment', $comment); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php index b7f42ae..91fdf2c 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php @@ -430,7 +430,7 @@ class CommentInterfaceTest extends CommentTestBase { function testCommentLinks() { // Bartik theme alters comment links, so use a different theme. theme_enable(array('stark')); - variable_set('theme_default', 'stark'); + config('system.theme')->set('default', 'stark')->save(); // Remove additional user permissions from $this->web_user added by setUp(), // since this test is limited to anonymous and authenticated roles only. diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php index 6ff9b72..a32fe7c 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php @@ -115,13 +115,14 @@ class NodeBlockFunctionalTest extends NodeTestBase { $this->assertText($node4->label(), t('Node found in block.')); // Create the custom block. + $theme_config = config('system.theme'); $custom_block = array(); $custom_block['info'] = $this->randomName(); $custom_block['title'] = $this->randomName(); $custom_block['types[article]'] = TRUE; $custom_block['body[value]'] = $this->randomName(32); - $custom_block['regions[' . variable_get('theme_default', 'stark') . ']'] = 'content'; - if ($admin_theme = variable_get('admin_theme')) { + $custom_block['regions[' . $theme_config->get('default') . ']'] = 'content'; + if ($admin_theme = $theme_config->get('admin')) { $custom_block['regions[' . $admin_theme . ']'] = 'content'; } $this->drupalPost('admin/structure/block/add', $custom_block, t('Save block')); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 3d83cd4..3731a23 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1421,7 +1421,7 @@ function template_preprocess_node(&$variables) { if (variable_get('node_submitted_' . $node->type, TRUE)) { $variables['display_submitted'] = TRUE; $variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date'])); - $variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', array('account' => $node)) : ''; + $variables['user_picture'] = theme_get_setting('features.node_user_picture') ? theme('user_picture', array('account' => $node)) : ''; } else { $variables['display_submitted'] = FALSE; diff --git a/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTestBase.php b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTestBase.php index 302c159..8d7140d 100644 --- a/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTestBase.php +++ b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTestBase.php @@ -27,7 +27,7 @@ abstract class OpenIDTestBase extends WebTestBase { ->key(array( 'module' => 'user', 'delta' => 'login', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => config('system.theme')->get('default'), )) ->fields(array( 'status' => 1, diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php index 278b1e0..20f649d 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php @@ -62,7 +62,7 @@ class ShortcutLinksTest extends ShortcutTestBase { */ function testShortcutQuickLink() { theme_enable(array('seven')); - variable_set('admin_theme', 'seven'); + config('system.theme')->set('admin', 'seven')->save(); variable_set('node_admin_theme', TRUE); $this->drupalGet($this->set->links[0]['link_path']); $this->assertRaw(t('Remove from %title shortcuts', array('%title' => $this->set->title)), '"Add to shortcuts" link properly switched to "Remove from shortcuts".'); @@ -120,7 +120,7 @@ class ShortcutLinksTest extends ShortcutTestBase { */ function testNoShortcutLink() { // Change to a theme that displays shortcuts. - variable_set('theme_default', 'seven'); + config('system.theme')->set('default', 'seven')->save(); $this->drupalGet('page-that-does-not-exist'); $this->assertNoRaw('add-shortcut', t('Add to shortcuts link was not shown on a page not found.')); diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 27eb8c2..7ebc28c 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -690,7 +690,7 @@ function shortcut_preprocess_page(&$variables) { $link_path = 'admin/config/user-interface/shortcut/link/' . $mlid . '/delete'; } - if (theme_get_setting('shortcut_module_link')) { + if (theme_get_setting('features.shortcut_module_link')) { $variables['title_suffix']['add_or_remove_shortcut'] = array( '#attached' => array( 'css' => array( diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php index 3df7347..b7111f7 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php @@ -83,7 +83,7 @@ class StatisticsReportsTest extends StatisticsTestBase { // Configure and save the block. $block = block_load('statistics', 'popular'); - $block->theme = variable_get('theme_default', 'stark'); + $block->theme = config('system.theme')->get('default'); $block->status = 1; $block->pages = ''; $block->region = 'sidebar_first'; diff --git a/core/modules/system/config/system.theme.global.yml b/core/modules/system/config/system.theme.global.yml new file mode 100644 index 0000000..fca8fd2 --- /dev/null +++ b/core/modules/system/config/system.theme.global.yml @@ -0,0 +1,19 @@ +favicon: + mimetype: image/vnd.microsoft.icon + path: '' + url: '' + use_default: '1' +features: + 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: + path: '' + url: '' + use_default: '1' diff --git a/core/modules/system/config/system.theme.yml b/core/modules/system/config/system.theme.yml new file mode 100644 index 0000000..5ec84d7 --- /dev/null +++ b/core/modules/system/config/system.theme.yml @@ -0,0 +1,3 @@ +admin: '0' +default: stark +maintenance: '' diff --git a/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php b/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php index d8748bc..6207df5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php @@ -154,7 +154,7 @@ class FrameworkTest extends AjaxTestBase { // The test theme overrides system.base.css without an implementation, // thereby removing it. theme_enable(array('test_theme')); - variable_set('theme_default', 'test_theme'); + config('system.theme')->set('default', 'test_theme')->save(); // This gets the form, and emulates an Ajax submission on it, including // adding markup to the HEAD and BODY for any lazy loaded JS/CSS files. diff --git a/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php b/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php index bef4812..2db6093 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php @@ -31,8 +31,10 @@ class PageTest extends WebTestBase { function testBatchProgressPageTheme() { // Make sure that the page which starts the batch (an administrative page) // is using a different theme than would normally be used by the batch API. - variable_set('theme_default', 'bartik'); - variable_set('admin_theme', 'seven'); + config('system.theme') + ->set('default', 'bartik') + ->set('admin', 'seven') + ->save(); // Log in as an administrator who can see the administrative theme. $admin_user = $this->drupalCreateUser(array('view the administration theme')); $this->drupalLogin($admin_user); diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php index 11db04e..f297af8 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php @@ -29,8 +29,10 @@ class RouterTest extends WebTestBase { // Make the tests below more robust by explicitly setting the default theme // and administrative theme that they expect. theme_enable(array('bartik')); - variable_set('theme_default', 'bartik'); - variable_set('admin_theme', 'seven'); + config('system.theme') + ->set('default', 'bartik') + ->set('admin', 'seven') + ->save(); theme_disable(array('stark')); // Enable navigation menu block. diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php index 30d8422..e3d8257 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php @@ -165,7 +165,8 @@ class ThemeTest extends WebTestBase { */ function testAdministrationTheme() { theme_enable(array('stark')); - variable_set('theme_default', 'stark'); + $config = config('system.theme'); + $config->set('default', 'stark')->save(); // Enable an administration theme and show it on the node admin pages. $edit = array( 'admin_theme' => 'seven', @@ -198,7 +199,7 @@ class ThemeTest extends WebTestBase { $this->assertRaw('core/themes/stark', t('Site default theme used on the add content page.')); // Reset to the default theme settings. - variable_set('theme_default', 'bartik'); + $config->set('default', 'bartik')->save(); $edit = array( 'admin_theme' => '0', 'node_admin_theme' => FALSE, @@ -220,7 +221,7 @@ class ThemeTest extends WebTestBase { theme_enable(array('bartik')); $this->drupalGet('admin/appearance'); $this->clickLink(t('Set default')); - $this->assertEqual(variable_get('theme_default', ''), 'bartik'); + $this->assertEqual(config('system.theme')->get('default'), 'bartik'); // Test the default theme on the secondary links (blocks admin page). $this->drupalGet('admin/structure/block'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php index 4be9dd5..475255b 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php @@ -124,7 +124,7 @@ class ThemeTest extends WebTestBase { * Ensures a themes template is overrideable based on the 'template' filename. */ function testTemplateOverride() { - variable_set('theme_default', 'test_theme'); + config('system.theme')->set('default', 'test_theme')->save(); $this->drupalGet('theme-test/template-test'); $this->assertText('Success: Template overridden.', t('Template overridden by defined \'template\' filename.')); } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 2947245..774e6af 100644 --- a/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. @@ -117,7 +118,7 @@ function system_themes_page() { $themes = system_rebuild_theme_data(); uasort($themes, 'system_sort_modules_by_info_name'); - $theme_default = variable_get('theme_default', 'stark'); + $theme_default = config('system.theme')->get('default'); $theme_groups = array(); foreach ($themes as &$theme) { @@ -240,12 +241,13 @@ function system_themes_admin_form($form, &$form_state, $theme_options) { '#type' => 'fieldset', '#title' => t('Administration theme'), ); + $admin_theme = config('system.theme')->get('admin'); $form['admin_theme']['admin_theme'] = array( '#type' => 'select', '#options' => array(0 => t('Default theme')) + $theme_options, '#title' => t('Administration theme'), '#description' => t('Choose "Default theme" to always use the same theme as the rest of the site.'), - '#default_value' => variable_get('admin_theme', 0), + '#default_value' => empty($admin_theme) ? 0 : $admin_theme, ); $form['admin_theme']['actions'] = array('#type' => 'actions'); $form['admin_theme']['actions']['submit'] = array( @@ -260,7 +262,7 @@ function system_themes_admin_form($form, &$form_state, $theme_options) { */ function system_themes_admin_form_submit($form, &$form_state) { drupal_set_message(t('The configuration options have been saved.')); - variable_set('admin_theme', $form_state['values']['admin_theme']); + config('system.theme')->set('admin', $form_state['values']['admin_theme'])->save(); } /** @@ -296,7 +298,7 @@ function system_theme_disable() { // Check if the specified theme is one recognized by the system. if (!empty($themes[$theme])) { - if ($theme == variable_get('theme_default', 'stark')) { + if ($theme == config('system.theme')->get('default')) { // Don't disable the default theme. drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error'); } @@ -329,7 +331,8 @@ function system_theme_default() { theme_enable(array($theme)); } // Set the default theme. - variable_set('theme_default', $theme); + $config = config('system.theme'); + $config->set('default', $theme)->save(); // Rebuild the menu. This duplicates the menu_router_rebuild() in // theme_enable(). However, modules must know the current default theme in @@ -341,7 +344,7 @@ function system_theme_default() { // The status message depends on whether an admin theme is currently in use: // a value of 0 means the admin theme is set to be the default theme. - $admin_theme = variable_get('admin_theme', 0); + $admin_theme = $config->get('admin'); if ($admin_theme != 0 && $admin_theme != $theme) { drupal_set_message(t('Please note that the administration theme is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array( '%admin_theme' => $themes[$admin_theme]->info['name'], @@ -368,20 +371,24 @@ function system_theme_default() { * @return * The form structure. * @ingroup forms + * @see system_theme_settings_validate() * @see system_theme_settings_submit() */ function system_theme_settings($form, &$form_state, $key = '') { // Default settings are defined in theme_get_setting() in includes/theme.inc if ($key) { $var = 'theme_' . $key . '_settings'; + $config_key = $key . '.settings'; $themes = list_themes(); $features = $themes[$key]->info['features']; } else { $var = 'theme_settings'; + $config_key = 'system.theme.global'; } $form['var'] = array('#type' => 'hidden', '#value' => $var); + $form['config_key'] = array('#type' => 'hidden', '#value' => $config_key); // Toggle settings $toggles = array( @@ -414,7 +421,7 @@ function system_theme_settings($form, &$form_state, $key = '') { ); foreach ($toggles as $name => $title) { if ((!$key) || in_array($name, $features)) { - $form['theme_settings']['toggle_' . $name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => theme_get_setting('toggle_' . $name, $key)); + $form['theme_settings']['toggle_' . $name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => theme_get_setting('features.' . $name, $key)); // Disable checkboxes for features not supported in the current configuration. if (isset($disabled['toggle_' . $name])) { $form['theme_settings']['toggle_' . $name]['#disabled'] = TRUE; @@ -438,7 +445,7 @@ function system_theme_settings($form, &$form_state, $key = '') { $form['logo']['default_logo'] = array( '#type' => 'checkbox', '#title' => t('Use the default logo supplied by the theme'), - '#default_value' => theme_get_setting('default_logo', $key), + '#default_value' => theme_get_setting('logo.use_default', $key), '#tree' => FALSE, ); $form['logo']['settings'] = array( @@ -453,7 +460,7 @@ function system_theme_settings($form, &$form_state, $key = '') { $form['logo']['settings']['logo_path'] = array( '#type' => 'textfield', '#title' => t('Path to custom logo'), - '#default_value' => theme_get_setting('logo_path', $key), + '#default_value' => theme_get_setting('logo.path', $key), ); $form['logo']['settings']['logo_upload'] = array( '#type' => 'file', @@ -472,7 +479,7 @@ function system_theme_settings($form, &$form_state, $key = '') { $form['favicon']['default_favicon'] = array( '#type' => 'checkbox', '#title' => t('Use the default shortcut icon supplied by the theme'), - '#default_value' => theme_get_setting('default_favicon', $key), + '#default_value' => theme_get_setting('favicon.use_default', $key), ); $form['favicon']['settings'] = array( '#type' => 'container', @@ -486,7 +493,7 @@ function system_theme_settings($form, &$form_state, $key = '') { $form['favicon']['settings']['favicon_path'] = array( '#type' => 'textfield', '#title' => t('Path to custom icon'), - '#default_value' => theme_get_setting('favicon_path', $key), + '#default_value' => theme_get_setting('favicon.path', $key), ); $form['favicon']['settings']['favicon_upload'] = array( '#type' => 'file', @@ -580,12 +587,7 @@ function system_theme_settings($form, &$form_state, $key = '') { } } - $form = system_settings_form($form); - // We don't want to call system_settings_form_submit(), so change #submit. - array_pop($form['#submit']); - $form['#submit'][] = 'system_theme_settings_submit'; - $form['#validate'][] = 'system_theme_settings_validate'; - return $form; + return system_config_form($form, $form_state); } /** @@ -678,10 +680,13 @@ function _system_theme_settings_validate_path($path) { * Process system_theme_settings form submissions. */ function system_theme_settings_submit($form, &$form_state) { + $config = config($form_state['values']['config_key']); + // Exclude unnecessary elements before saving. form_state_values_clean($form_state); $key = $form_state['values']['var']; unset($form_state['values']['var']); + unset($form_state['values']['config_key']); $values = $form_state['values']; @@ -715,9 +720,10 @@ function system_theme_settings_submit($form, &$form_state) { $values['favicon_mimetype'] = file_get_mimetype($values['favicon_path']); } - variable_set($key, $values); - drupal_set_message(t('The configuration options have been saved.')); - + // 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)); } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 96c02c3..d03af81 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -507,7 +507,7 @@ function system_requirements($phase) { */ function system_install() { // Enable the default theme. - variable_set('theme_default', 'stark'); + config('system.theme')->set('default', 'stark')->save(); db_update('system') ->fields(array('status' => 1)) ->condition('type', 'theme') @@ -1998,6 +1998,32 @@ function system_update_8014() { } /** + * Moves system theme settings from variables to config. + */ +function system_update_8015() { + $variables = array('theme_settings' => 'system.theme.global'); + $themes = list_themes(); + foreach ($themes as $theme) { + $variables['theme_' . $theme->name . '_settings'] = $theme->name . '.settings'; + } + + foreach ($variables as $old_key => $new_key) { + $config = theme_convert_variables_to_config(variable_get($old_key, array())); + $new_config = config($new_key); + foreach ($config as $key => $value) { + $new_config->set($key, $value); + } + $new_config->save(); + } + + update_variables_to_config('system.theme', array( + 'admin_theme' => 'admin', + 'theme_default' => 'default', + 'maintenance_theme' => 'maintenance', + )); +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */ diff --git a/core/modules/system/system.module b/core/modules/system/system.module index a530c30..98e86ba 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -237,7 +237,7 @@ function system_permission() { ), 'view the administration theme' => array( 'title' => t('View the administration theme'), - 'description' => variable_get('admin_theme') ? '' : t('This is only used when the site is configured to use a separate administration theme on the Appearance page.', array('@appearance-url' => url('admin/appearance'))), + 'description' => config('system.theme')->get('admin') ? '' : t('This is only used when the site is configured to use a separate administration theme on the Appearance page.', array('@appearance-url' => url('admin/appearance'))), ), 'access site reports' => array( 'title' => t('View site reports'), @@ -2202,7 +2202,7 @@ function system_custom_theme() { if ($request = request()) { $path = $request->attributes->get('system_path'); if (user_access('view the administration theme') && path_is_admin($path)) { - return variable_get('admin_theme'); + return config('system.theme')->get('admin'); } } } diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index 8f24a4f..2440fe6 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -462,7 +462,7 @@ function menu_test_theme_page_callback($inherited = FALSE) { function menu_test_theme_callback($argument) { // Test using the variable administrative theme. if ($argument == 'use-admin-theme') { - return variable_get('admin_theme'); + return config('system.theme')->get('admin'); } // Test using a theme that exists, but may or may not be enabled. elseif ($argument == 'use-stark-theme') { diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php index b98132e..3693b97 100644 --- a/core/modules/system/theme.api.php +++ b/core/modules/system/theme.api.php @@ -87,7 +87,7 @@ function hook_form_system_theme_settings_alter(&$form, &$form_state) { $form['toggle_breadcrumb'] = array( '#type' => 'checkbox', '#title' => t('Display the breadcrumb'), - '#default_value' => theme_get_setting('toggle_breadcrumb'), + '#default_value' => theme_get_setting('features.breadcrumb'), '#description' => t('Show a trail of links from the homepage to the current page.'), ); } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php index baa5c61..4c763b3 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php @@ -25,8 +25,10 @@ class ThemeTest extends TaxonomyTestBase { // Make sure we are using distinct default and administrative themes for // the duration of these tests. - variable_set('theme_default', 'bartik'); - variable_set('admin_theme', 'seven'); + config('system.theme') + ->set('default', 'bartik') + ->set('admin', 'seven') + ->save(); // Create and log in as a user who has permission to add and edit taxonomy // terms and view the administrative theme. diff --git a/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php b/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php index 8e69750..c1e6553 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php @@ -29,7 +29,7 @@ class UserBlocksTests extends WebTestBase { ->key(array( 'module' => 'user', 'delta' => 'login', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => config('system.theme')->get('default'), )) ->fields(array( 'status' => 1, diff --git a/core/modules/user/user.module b/core/modules/user/user.module index e373062..c3812f97 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1290,7 +1290,7 @@ function template_preprocess_username(&$variables) { $variables['extra'] = ''; if (empty($account->uid)) { $variables['uid'] = 0; - if (theme_get_setting('toggle_comment_user_verification')) { + if (theme_get_setting('features.comment_user_verification')) { $variables['extra'] = ' (' . t('not verified') . ')'; } } diff --git a/core/themes/bartik/bartik.info b/core/themes/bartik/bartik.info index c0c206d..e1652c6 100644 --- a/core/themes/bartik/bartik.info +++ b/core/themes/bartik/bartik.info @@ -30,4 +30,4 @@ regions[footer_thirdcolumn] = Footer third column regions[footer_fourthcolumn] = Footer fourth column regions[footer] = Footer -settings[shortcut_module_link] = 0 +settings[features][shortcut_module_link] = 0 diff --git a/core/themes/bartik/color/color.inc b/core/themes/bartik/color/color.inc index 50ce731..f70450c 100644 --- a/core/themes/bartik/color/color.inc +++ b/core/themes/bartik/color/color.inc @@ -6,7 +6,7 @@ */ // Put the logo path into JavaScript for the live preview. -drupal_add_js(array('color' => array('logo' => theme_get_setting('logo', 'bartik'))), 'setting'); +drupal_add_js(array('color' => array('logo' => theme_get_setting('logo.url', 'bartik'))), 'setting'); $info = array( // Available colors and color labels used in theme. diff --git a/core/themes/bartik/template.php b/core/themes/bartik/template.php index 5373c92..b1dbb51 100644 --- a/core/themes/bartik/template.php +++ b/core/themes/bartik/template.php @@ -50,8 +50,8 @@ function bartik_process_page(&$variables) { } // Always print the site name and slogan, but if they are toggled off, we'll // just hide them visually. - $variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE; - $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE; + $variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE; + $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE; if ($variables['hide_site_name']) { // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. $variables['site_name'] = check_plain($site_config->get('name')); @@ -98,8 +98,8 @@ function bartik_process_maintenance_page(&$variables) { $site_config = config('system.site'); // Always print the site name and slogan, but if they are toggled off, we'll // just hide them visually. - $variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE; - $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE; + $variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE; + $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE; if ($variables['hide_site_name']) { // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. $variables['site_name'] = check_plain($site_config->get('name')); diff --git a/core/themes/seven/seven.info b/core/themes/seven/seven.info index 969f749..69d052d 100644 --- a/core/themes/seven/seven.info +++ b/core/themes/seven/seven.info @@ -5,7 +5,7 @@ version = VERSION core = 8.x stylesheets[screen][] = reset.css stylesheets[screen][] = style.css -settings[shortcut_module_link] = 1 +settings[features][shortcut_module_link] = 1 regions[content] = Content regions[help] = Help regions[page_top] = Page top diff --git a/profiles/minimal/minimal.install b/profiles/minimal/minimal.install index 2c4cee1..65270ed 100644 --- a/profiles/minimal/minimal.install +++ b/profiles/minimal/minimal.install @@ -15,7 +15,7 @@ function minimal_install() { // Enable Bartik theme and set it as default theme instead of Stark. // @see system_install() $default_theme = 'bartik'; - variable_set('theme_default', $default_theme); + config('system.theme')->set('default', $default_theme); theme_enable(array($default_theme)); theme_disable(array('stark')); diff --git a/profiles/standard/standard.install b/profiles/standard/standard.install index 27faf10..593269d 100644 --- a/profiles/standard/standard.install +++ b/profiles/standard/standard.install @@ -71,7 +71,8 @@ function standard_install() { // Enable Bartik theme and set it as default theme instead of Stark. // @see system_install() $default_theme = 'bartik'; - variable_set('theme_default', $default_theme); + $theme_config = config('system.theme'); + $theme_config->set('default', $default_theme)->save(); theme_enable(array($default_theme)); theme_disable(array('stark')); @@ -409,6 +410,6 @@ function standard_install() { ->condition('type', 'theme') ->condition('name', 'seven') ->execute(); - variable_set('admin_theme', 'seven'); + $theme_config->set('admin', 'seven')->save(); variable_set('node_admin_theme', '1'); }