From f2d0c30d2439dd8eabb6bba49dda10d2f6c7a501 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Thu, 1 Nov 2012 19:12:15 +0100 Subject: [PATCH] Issue #1829224 by pfrenssen: Convert the 'theme_default' variable to CMI. --- core/includes/ajax.inc | 2 +- core/includes/theme.inc | 4 ++-- core/includes/theme.maintenance.inc | 3 ++- core/modules/block/block.admin.inc | 6 +++--- core/modules/block/block.module | 8 ++++---- .../Drupal/block/Tests/BlockHiddenRegionTest.php | 4 ++-- .../Drupal/block/Tests/BlockInvalidRegionTest.php | 4 ++-- .../block/Tests/NewDefaultThemeBlocksTest.php | 4 ++-- .../color/lib/Drupal/color/Tests/ColorTest.php | 4 ++-- .../lib/Drupal/comment/Tests/CommentLinksTest.php | 2 +- .../Drupal/node/Tests/NodeBlockFunctionalTest.php | 2 +- .../lib/Drupal/openid/Tests/OpenIDTestBase.php | 2 +- core/modules/php/php.module | 6 +++--- .../Drupal/shortcut/Tests/ShortcutLinksTest.php | 2 +- .../statistics/Tests/StatisticsReportsTest.php | 2 +- core/modules/system/config/system.theme.yml | 1 + .../lib/Drupal/system/Tests/Ajax/FrameworkTest.php | 2 +- .../lib/Drupal/system/Tests/Batch/PageTest.php | 2 +- .../lib/Drupal/system/Tests/Menu/RouterTest.php | 2 +- .../lib/Drupal/system/Tests/System/ThemeTest.php | 4 ++-- .../Tests/Theme/EntityFilteringThemeTest.php | 2 +- .../lib/Drupal/system/Tests/Theme/ThemeTest.php | 2 +- core/modules/system/system.admin.inc | 8 ++++---- core/modules/system/system.install | 13 ++++++++++++- .../lib/Drupal/taxonomy/Tests/ThemeTest.php | 2 +- .../user/lib/Drupal/user/Tests/UserBlocksTests.php | 2 +- .../Plugin/views/display/DisplayPluginBase.php | 2 +- core/profiles/standard/standard.install | 2 +- sites/default/default.settings.php | 6 +++--- 29 files changed, 59 insertions(+), 46 deletions(-) diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index 45bb706..17c4ff4 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/theme.inc b/core/includes/theme.inc index cc29a98..ef8a2a2 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -90,7 +90,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. @@ -1440,7 +1440,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; diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 4b3e80c..8d3c4bb 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -50,7 +50,8 @@ 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')); + $default_theme = config('system.theme')->get('default'); + $custom_theme = variable_get('maintenance_theme', $default_theme); } // Ensure that system.module is loaded. diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc index 2a17a55..68b2aa0 100644 --- a/core/modules/block/block.admin.inc +++ b/core/modules/block/block.admin.inc @@ -310,7 +310,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) { '#tree' => TRUE, ); - $theme_default = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); $admin_theme = variable_get('admin_theme'); foreach (list_themes() as $key => $theme) { // Only display enabled themes @@ -324,7 +324,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) { // Use a meaningful title for the main site theme and administrative // theme. $theme_title = $theme->info['name']; - if ($key == $theme_default) { + if ($key == $default_theme) { $theme_title = t('!theme (default theme)', array('!theme' => $theme_title)); } elseif ($admin_theme && $key == $admin_theme) { @@ -336,7 +336,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) { '#default_value' => !empty($region) && $region != -1 ? $region : NULL, '#empty_value' => BLOCK_REGION_NONE, '#options' => system_region_list($key, REGIONS_VISIBLE), - '#weight' => ($key == $theme_default ? 9 : 10), + '#weight' => ($key == $default_theme ? 9 : 10), ); } } diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 2978146..7affb25 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 af5acb9..ea0ceb0 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php @@ -37,7 +37,7 @@ function setUp() { ->key(array( 'module' => 'search', 'delta' => 'form', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => config('system.theme')->get('default'), )) ->fields(array( 'status' => 1, @@ -64,7 +64,7 @@ function testBlockNotInHiddenRegion() { // 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 f372c13..6b8a527 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php @@ -45,7 +45,7 @@ function testBlockInInvalidRegion() { ->key(array( 'module' => 'block_test', 'delta' => 'test_html_id', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => config('system.theme')->get('default'), )) ->fields(array( 'status' => 1, @@ -69,7 +69,7 @@ function testBlockInInvalidRegion() { ->key(array( 'module' => 'block_test', 'delta' => 'test_html_id', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => config('system.theme')->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 c133f17..7031ef5 100644 --- a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php @@ -39,7 +39,7 @@ function testNewDefaultThemeBlocks() { // Ensure no other theme's blocks are in the block table yet. $themes = array(); - $themes['default'] = variable_get('theme_default', 'stark'); + $themes['default'] = config('system.theme')->get('default'); if ($admin_theme = variable_get('admin_theme')) { $themes['admin'] = $admin_theme; } @@ -59,7 +59,7 @@ function testNewDefaultThemeBlocks() { // 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 8902d4c..7572206 100644 --- a/core/modules/color/lib/Drupal/color/Tests/ColorTest.php +++ b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php @@ -76,7 +76,7 @@ function testColor() { * 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); @@ -122,7 +122,7 @@ function _testColor($theme, $test_values) { * 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/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php index e1dcbec..7006063 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -35,7 +35,7 @@ public static function getInfo() { 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 edcb007..ff96db1 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php @@ -128,7 +128,7 @@ function testRecentNodeBlock() { $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'; + $custom_block['regions[' . config('system.theme')->get('default') . ']'] = 'content'; if ($admin_theme = variable_get('admin_theme')) { $custom_block['regions[' . $admin_theme . ']'] = 'content'; } diff --git a/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTestBase.php b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTestBase.php index f88ba92..c308186 100644 --- a/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTestBase.php +++ b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTestBase.php @@ -29,7 +29,7 @@ function setUp() { ->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/php/php.module b/core/modules/php/php.module index 8e885e4..568cc87 100644 --- a/core/modules/php/php.module +++ b/core/modules/php/php.module @@ -61,16 +61,16 @@ function php_permission() { * @see php_filter_info() */ function php_eval($code) { - global $theme_path, $theme_info, $conf; + global $theme_path, $theme_info; // Store current theme path. $old_theme_path = $theme_path; // Restore theme_path to the theme, as long as php_eval() executes, // so code evaluated will not see the caller module as the current theme. - // If theme info is not initialized get the path from theme_default. + // If theme info is not initialized get the default theme path from config(). if (!isset($theme_info)) { - $theme_path = drupal_get_path('theme', $conf['theme_default']); + $theme_path = drupal_get_path('theme', config('system.theme')->get('default')); } else { $theme_path = dirname($theme_info->filename); diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php index 54eeab4..9a5fdd5 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php @@ -122,7 +122,7 @@ function testShortcutLinkDelete() { */ 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', 'Add to shortcuts link was not shown on a page not found.'); diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php index 80e6c38..90fce80 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 @@ function testPopularContentBlock() { // 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.yml b/core/modules/system/config/system.theme.yml index 40fad06..b294ea5 100644 --- a/core/modules/system/config/system.theme.yml +++ b/core/modules/system/config/system.theme.yml @@ -1,2 +1,3 @@ enabled: stark: '0' +default: stark \ No newline at end of file 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 00e7f14..e4121a8 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 @@ function testLazyLoadOverriddenCSS() { // 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 db1d671..293542d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php @@ -35,7 +35,7 @@ public static function getInfo() { 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'); + config('system.theme')->set('default', 'bartik')->save(); theme_enable(array('seven')); variable_set('admin_theme', 'seven'); // Log in as an administrator who can see the administrative theme. 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 a550048..f33a1c6 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php @@ -37,7 +37,7 @@ function setUp() { // 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'); + config('system.theme')->set('default', 'bartik')->save(); variable_set('admin_theme', 'seven'); theme_disable(array('stark')); 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 111e6b7..c2e25d2 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php @@ -206,7 +206,7 @@ function testAdministrationTheme() { $this->assertRaw('core/themes/stark', 'Site default theme used on the add content page.'); // Reset to the default theme settings. - variable_set('theme_default', 'bartik'); + config('system.theme')->set('default', 'bartik')->save(); $edit = array( 'admin_theme' => '0', 'node_admin_theme' => FALSE, @@ -228,7 +228,7 @@ function testSwitchDefaultTheme() { 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/EntityFilteringThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php index 27f3e6a..8233ec3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/EntityFilteringThemeTest.php @@ -130,7 +130,7 @@ function testThemedEntity() { // Check each path in all available themes. foreach ($this->themes as $theme) { - variable_set('theme_default', $theme); + config('system.theme')->set('default', $theme)->save(); foreach ($paths as $path) { $this->drupalGet($path); $this->assertResponse(200); 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 bd6c93b..2dfb8b7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php @@ -132,7 +132,7 @@ function testCSSOverride() { * 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.', 'Template overridden by defined \'template\' filename.'); } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index c55289c..d66de23 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -117,7 +117,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'); + $default_theme = config('system.theme')->get('default'); $theme_groups = array(); $admin_theme = variable_get('admin_theme', 0); @@ -125,7 +125,7 @@ function system_themes_page() { if (!empty($theme->info['hidden'])) { continue; } - $theme->is_default = ($theme->name == $theme_default); + $theme->is_default = ($theme->name == $default_theme); // Identify theme screenshot. $theme->screenshot = NULL; @@ -308,7 +308,7 @@ function system_theme_disable() { // Check if the specified theme is one recognized by the system. if (!empty($themes[$theme])) { // Do not disable the default or admin theme. - if ($theme == variable_get('theme_default', 'stark') || $theme == variable_get('admin_theme', 0)) { + if ($theme == config('system.theme')->get('default') || $theme == variable_get('admin_theme', 0)) { drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error'); } else { @@ -340,7 +340,7 @@ function system_theme_default() { theme_enable(array($theme)); } // Set the default theme. - variable_set('theme_default', $theme); + config('system.theme')->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 diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 1f191ac..c157765 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -509,7 +509,7 @@ function system_requirements($phase) { function system_install() { // Enable the default theme. Can't use theme_enable() this early in // installation. - variable_set('theme_default', 'stark'); + config('system.theme')->set('default', 'stark')->save(); config_install_default_config('theme', 'stark'); // Populate the cron key variable. @@ -2203,6 +2203,17 @@ function system_update_8032() { } /** + * Move the theme settings from variable to config. + * + * @ingroup config_upgrade + */ +function system_update_8033() { + update_variables_to_config('system.theme', array( + 'theme_default' => 'default', + )); +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */ diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php index b226970..bd59607 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php @@ -25,7 +25,7 @@ function setUp() { // Make sure we are using distinct default and administrative themes for // the duration of these tests. - variable_set('theme_default', 'bartik'); + config('system.theme')->set('default', 'bartik')->save(); theme_enable(array('seven')); variable_set('admin_theme', 'seven'); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php b/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php index 07c71e8..3805ddb 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php @@ -37,7 +37,7 @@ function setUp() { ->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/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index 1ad673b..6a93f43 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -1680,7 +1680,7 @@ public function buildOptionsForm(&$form, &$form_state) { $this->theme = $theme; } elseif (empty($this->theme)) { - $this->theme = variable_get('theme_default', 'bartik'); + $this->theme = config('system.theme')->get('default'); } if (isset($GLOBALS['theme']) && $GLOBALS['theme'] == $this->theme) { diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index b4dc761..c3f4adb 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -71,7 +71,7 @@ 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); + config('system.theme')->set('default', $default_theme)->save(); theme_enable(array($default_theme)); theme_disable(array('stark')); diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 9b1c7ce..c036c70 100755 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -364,13 +364,13 @@ * administration interface. * * The following overrides are examples: - * - site_name: Defines the site's name. - * - theme_default: Defines the default theme for this site. + * - $conf['system.site']['name']: Defines the site's name. + * - $conf['system.theme']['default']: Defines the default theme for this site. * - anonymous: Defines the human-readable name of anonymous users. * Remove the leading hash signs to enable. */ # $conf['system.site']['name'] = 'My Drupal site'; -# $conf['theme_default'] = 'stark'; +# $conf['system.theme']['default'] = 'stark'; # $conf['anonymous'] = 'Visitor'; /** -- 1.7.4.1