diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index d8eb913..212dff6 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 cc60af2..3051560 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. @@ -1530,7 +1530,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 0b426e2..a03722a 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -50,7 +50,7 @@ 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')); + $custom_theme = variable_get('maintenance_theme', config('system.theme')->get('default')) ?: 'bartik'; } // Ensure that system.module is loaded. diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc index e5e8d76..eab2d8d 100644 --- a/core/modules/block/block.admin.inc +++ b/core/modules/block/block.admin.inc @@ -70,7 +70,7 @@ function block_admin_edit(Block $entity) { $theme = $themes[$theme_key]; // Use meaningful titles for the main site and administrative themes. $theme_title = $theme->info['name']; - if ($theme_key == variable_get('theme_default', 'stark')) { + if ($theme_key == config('system.theme')->get('default')) { $theme_title = t('!theme (default theme)', array('!theme' => $theme_title)); } elseif ($admin_theme && $theme_key == $admin_theme) { diff --git a/core/modules/block/block.module b/core/modules/block/block.module index ff804b2..97ad2d2 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -59,7 +59,7 @@ function block_help($path, $arg) { $output .= '
' . t('Blocks can be configured to be visible only on certain pages, only to users of certain roles, or only on pages displaying certain content types. Some dynamic blocks, such as those generated by modules, will be displayed only on certain pages.', array('@content-type' => url('admin/structure/types'), '@user' => url('user'))) . '
'; if (module_exists('custom_block')) { $output .= '
' . t('Creating custom blocks') . '
'; - $output .= '
' . t('Users with the Administer blocks permission can add custom blocks, which are then listed on the Blocks administration page. Once created, custom blocks behave just like default and module-generated blocks.', array('@blocks' => url('admin/structure/block'), '@block-add' => url('admin/structure/block/list/block_plugin_ui:' . variable_get('theme_default', 'stark') . '/add/custom_blocks'))) . '
'; + $output .= '
' . t('Users with the Administer blocks permission can add custom blocks, which are then listed on the Blocks administration page. Once created, custom blocks behave just like default and module-generated blocks.', array('@blocks' => url('admin/structure/block'), '@block-add' => url('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add/custom_blocks'))) . '
'; } $output .= ''; return $output; @@ -69,7 +69,7 @@ function block_help($path, $arg) { list(, $demo_theme) = explode(':', $arg[4]); } else { - $demo_theme = variable_get('theme_default', 'stark'); + $demo_theme = 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.') . '

'; @@ -112,7 +112,7 @@ function block_permission() { * @todo Clarify the documentation for the per-plugin block admin links. */ 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.', @@ -267,7 +267,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'))), @@ -363,7 +363,7 @@ function _block_get_renderable_region($list = array()) { * Blocks currently exported by modules. */ function _block_rehash($theme = NULL) { - $theme = $theme ? $theme : variable_get('theme_default', 'stark'); + $theme = $theme ? $theme : config('system.theme')->get('default'); $regions = system_region_list($theme); $blocks = entity_load_multiple_by_properties('block', array('theme' => $theme)); foreach ($blocks as $block_id => $block) { @@ -412,7 +412,7 @@ function block_theme_initialize($theme) { // Initialize theme's blocks if none already registered. $has_blocks = entity_load_multiple_by_properties('block', array('theme' => $theme)); 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); $default_theme_blocks = entity_load_multiple_by_properties('block', array('theme' => $default_theme)); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php index ccc7eca..0094c42 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php @@ -182,7 +182,7 @@ public function save(array $form, array &$form_state) { $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . $theme; } else { - $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . variable_get('theme_default', 'stark'); + $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . config('system.theme')->get('default'); } } else { diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php index c16439c..1232420 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php @@ -61,7 +61,9 @@ public 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/BlockLanguageTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php index 16531df..f247648 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php @@ -54,7 +54,7 @@ function setUp() { */ public function testLanguageBlockVisibility() { // Check if the visibility setting is available. - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); $this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme); $this->assertField('visibility[language][langcodes][en]', 'Language visibility field is visible.'); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php index c469eb6..d707c80 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php @@ -40,7 +40,7 @@ function testBlockThemeHookSuggestions() { $block = entity_create('block', array( 'plugin' => 'system_menu_block:menu-admin', 'region' => 'footer', - 'id' => variable_get('theme_default', 'stark') . '.machinename', + 'id' => config('system.theme')->get('default') . '.machinename', )); $variables = array(); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index 38a0d29..60be778 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -65,7 +65,7 @@ function setUp() { * Test creating custom block, moving it to a specific region and then deleting it. */ public function testCustomBlock() { - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); // Clear the block cache to load the Custom Block module's block definitions. $this->container->get('plugin.manager.block')->clearCachedDefinitions(); @@ -150,7 +150,7 @@ public function testCustomBlock() { * Test creating custom block using Full HTML. */ public function testCustomBlockFormat() { - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); // Add a new custom block by filling out the input form on block/add/basic. $info = strtolower($this->randomName(8)); @@ -200,7 +200,7 @@ function testBlockVisibility() { // Create a random title for the block. $title = $this->randomName(8); // Enable a standard block. - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); $edit = array( 'machine_name' => strtolower($this->randomName(8)), 'region' => 'sidebar_first', @@ -240,7 +240,7 @@ function testBlockVisibilityListedEmpty() { // Create a random title for the block. $title = $this->randomName(8); // Enable a standard block. - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); $edit = array( 'machine_name' => strtolower($this->randomName(8)), 'region' => 'sidebar_first', @@ -273,7 +273,7 @@ function testBlock() { $block['id'] = 'system_powered_by_block'; $block['label'] = $this->randomName(8); $block['machine_name'] = strtolower($this->randomName(8)); - $block['theme'] = variable_get('theme_default', 'stark'); + $block['theme'] = config('system.theme')->get('default'); $block['region'] = 'header'; // Set block title to confirm that interface works and override any custom titles. @@ -320,7 +320,7 @@ function testBlock() { */ function moveBlockToRegion(array $block, $region) { // Set the created block to a specific region. - $block += array('theme' => variable_get('theme_default', 'stark')); + $block += array('theme' => config('system.theme')->get('default')); $edit = array(); $edit['blocks[' . $block['theme'] . '.' . $block['machine_name'] . '][region]'] = $region; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); @@ -354,7 +354,7 @@ function testBlockRehash() { $block = array(); $block['id'] = 'test_cache'; $block['machine_name'] = strtolower($this->randomName(8)); - $block['theme'] = variable_get('theme_default', 'stark'); + $block['theme'] = config('system.theme')->get('default'); $block['region'] = 'header'; $block = $this->drupalPlaceBlock('test_cache', array('region' => 'header')); @@ -413,7 +413,7 @@ function testBlockModuleDisable() { } // Ensure that the disabled module's block plugin is no longer available. - $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . variable_get('theme_default', 'stark') . '/add'); + $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add'); $this->assertNoText(t('Test block caching')); // Confirm that the block is no longer displayed on the front page. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php index 41f7a14..b04f9fc 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php @@ -47,7 +47,7 @@ function testXSSInTitle() { $this->assertNoRaw('', 'The block title was properly sanitized when rendered.'); $this->drupalLogin($this->drupalCreateUser(array('administer blocks', 'access administration pages'))); - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . $default_theme . '/add'); $this->assertNoRaw("", 'The block title was properly sanitized in Block Plugin UI Admin page.'); } diff --git a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php index 190570c..f9a7792 100644 --- a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php @@ -33,7 +33,7 @@ public static function getInfo() { * Check the enabled Bartik blocks are correctly copied over. */ function testNewDefaultThemeBlocks() { - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); // Add several block instances. $this->adminUser = $this->drupalCreateUser(array('administer blocks')); @@ -51,7 +51,9 @@ function testNewDefaultThemeBlocks() { $new_theme = 'bartik'; $this->assertFalse($new_theme == $default_theme, 'The new theme is different from the previous default theme.'); theme_enable(array($new_theme)); - variable_set('theme_default', $new_theme); + config('system.theme') + ->set('default', $new_theme) + ->save(); // Ensure that the new theme has all the blocks as the previous default. // @todo Replace the string manipulation below once the configuration diff --git a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php index b91bdcf..5f3b776 100644 --- a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php @@ -142,7 +142,7 @@ protected function testDeleteBlockDisplay() { */ public function testViewsBlockForm() { $this->drupalLogin($this->drupalCreateUser(array('administer blocks'))); - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); $this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme); $elements = $this->xpath('//input[@name="label"]'); $this->assertTrue(empty($elements), 'The label field is not found for Views blocks.'); diff --git a/core/modules/ckeditor/ckeditor.module b/core/modules/ckeditor/ckeditor.module index c566f3a..2b1358f 100644 --- a/core/modules/ckeditor/ckeditor.module +++ b/core/modules/ckeditor/ckeditor.module @@ -97,7 +97,7 @@ function ckeditor_theme() { function _ckeditor_theme_css($theme = NULL) { $css = array(); if (!isset($theme)) { - $theme = variable_get('theme_default'); + $theme = config('system.theme')->get('default'); } if ($theme_path = drupal_get_path('theme', $theme)) { $info = system_get_info('theme', $theme); diff --git a/core/modules/color/lib/Drupal/color/Tests/ColorTest.php b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php index 6720e04..fea5686 100644 --- a/core/modules/color/lib/Drupal/color/Tests/ColorTest.php +++ b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php @@ -76,7 +76,9 @@ 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 +124,9 @@ 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 91cab48..8deb4e3 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -35,7 +35,9 @@ 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/menu/lib/Drupal/menu/Tests/MenuTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php index 88283cc..9f4dcc6 100644 --- a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php +++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php @@ -157,7 +157,7 @@ function addCustomMenu() { // Enable the custom menu block. $menu_name = 'menu-' . $menu_name; // Drupal prepends the name with 'menu-'. // Confirm that the custom menu block is available. - $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . variable_get('theme_default', 'stark') . '/add'); + $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add'); $this->assertText($label); // Enable the block. diff --git a/core/modules/php/php.module b/core/modules/php/php.module index 8e885e4..83f0b66 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 path from default theme. 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 fc953e5..ca1d88b 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php @@ -136,7 +136,9 @@ 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/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php index 6dbf439..bc472c4 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -119,6 +119,8 @@ protected function setUp() { $modules = array_reverse($modules); $modules = call_user_func_array('array_merge_recursive', $modules); $this->enableModules($modules, FALSE); + // In order to use theme functions default theme config needs to exist. + config('system.theme')->set('default', 'stark'); } protected function tearDown() { diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index dce2ceb..4aa9032 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -376,7 +376,7 @@ protected function drupalPlaceBlock($plugin_id, array $values = array(), array $ 'plugin' => $plugin_id, 'label' => $this->randomName(8), 'region' => 'sidebar_first', - 'theme' => variable_get('theme_default', 'stark'), + 'theme' => config('system.theme')->get('default'), 'machine_name' => strtolower($this->randomName(8)), 'settings' => $settings, ); diff --git a/core/modules/system/config/system.theme.yml b/core/modules/system/config/system.theme.yml index cf330e1..c56c7f2 100644 --- a/core/modules/system/config/system.theme.yml +++ b/core/modules/system/config/system.theme.yml @@ -1,3 +1,4 @@ admin: '0' enabled: stark: '0' +default: stark 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 e7aa0e0..f8944f9 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Ajax/FrameworkTest.php @@ -157,7 +157,9 @@ 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 97593f2..be6bcef 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,9 @@ 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')); config('system.theme')->set('admin', 'seven')->save(); // Log in as an administrator who can see the administrative theme. diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php index 39494fd..7a0eb1f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php @@ -60,8 +60,10 @@ function setUp() { $this->admin_theme = 'seven'; $this->alternate_theme = 'stark'; theme_enable(array($this->default_theme)); - variable_set('theme_default', $this->default_theme); - config('system.theme')->set('admin', $this->admin_theme)->save(); + config('system.theme') + ->set('default', $this->default_theme) + ->set('admin', $this->admin_theme) + ->save(); theme_disable(array($this->alternate_theme)); $this->drupalPlaceBlock('system_menu_block:menu-tools'); } 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 8cf14d5..f636849 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ThemeTest.php @@ -205,7 +205,9 @@ 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, @@ -227,7 +229,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..3545553 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,9 @@ 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/ThemeInfoStylesTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeInfoStylesTest.php index c2b6c43..54ee1d2 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeInfoStylesTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeInfoStylesTest.php @@ -34,7 +34,9 @@ public static function getInfo() { */ function testStylesheets() { theme_enable(array('test_basetheme', 'test_subtheme')); - variable_set('theme_default', 'test_subtheme'); + config('system.theme') + ->set('default', 'test_subtheme') + ->save(); $base = drupal_get_path('theme', 'test_basetheme'); // Unlike test_basetheme (and the original module CSS), the subtheme decides 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 6e9b383..ce5f96a 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,9 @@ 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/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php index 13b649c..c62f7c3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTestTwig.php @@ -38,7 +38,9 @@ function setUp() { * Ensures a themes template is overrideable based on the 'template' filename. */ function testTemplateOverride() { - variable_set('theme_default', 'test_theme_twig'); + config('system.theme') + ->set('default', 'test_theme_twig') + ->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/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php index 401e021..0bcd1a6 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php @@ -35,7 +35,7 @@ public static function getInfo() { function testTwigDebugMarkup() { $extension = twig_extension(); theme_enable(array('test_theme_twig')); - variable_set('theme_default', 'test_theme_twig'); + config('system.theme')->set('default', 'test_theme_twig')->save(); // Enable debug, rebuild the service container, and clear all caches. $this->settingsSet('twig_debug', TRUE); $this->rebuildContainer(); diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php index 36033bd..b9129e3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php @@ -46,7 +46,7 @@ public function testBlockUpgradeTitleLength() { 'machine_name' => strtolower($this->randomName(8)), 'region' => 'sidebar_first', ); - $this->drupalPost('admin/structure/block/add/system_powered_by_block/' . variable_get('theme_default', 'stark'), $settings, t('Save block')); + $this->drupalPost('admin/structure/block/add/system_powered_by_block/' . config('system.theme')->get('default'), $settings, t('Save block')); $this->assertText($settings['label'], 'Block with title longer than 64 characters successfully created.'); // Try to add a block with a title over 255 characters. @@ -55,7 +55,7 @@ public function testBlockUpgradeTitleLength() { 'machine_name' => strtolower($this->randomName(8)), 'region' => 'sidebar_first', ); - $this->drupalPost('admin/structure/block/add/system_powered_by_block/' . variable_get('theme_default', 'stark'), $settings, t('Save block')); + $this->drupalPost('admin/structure/block/add/system_powered_by_block/' . config('system.theme')->get('default'), $settings, t('Save block')); // Confirm that the custom block cannot be created with title longer than // the maximum number of characters. diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index a2c7011..b367033 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -124,7 +124,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(); $admin_theme = config('system.theme')->get('admin'); @@ -315,7 +315,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 == config('system.theme')->get('admin')) { + if ($theme === config('system.theme')->get('default') || $theme === config('system.theme')->get('admin')) { drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error'); } else { @@ -347,7 +347,9 @@ 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 daac6ba..c21d62a 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -521,10 +521,12 @@ function system_requirements($phase) { * Implements hook_install(). */ function system_install() { - // Enable the default theme. Can't use theme_enable() this early in + // Enable and set the default theme. Can't use theme_enable() this early in // installation. - variable_set('theme_default', 'stark'); config_install_default_config('theme', 'stark'); + config('system.theme') + ->set('default', 'stark') + ->save(); // Populate the cron key state variable. $cron_key = drupal_hash_base64(drupal_random_bytes(55)); @@ -1972,7 +1974,8 @@ function system_update_8040() { */ function system_update_8041() { update_variables_to_config('system.theme', array( - 'admin_theme' => 'admin' + 'admin_theme' => 'admin', + 'theme_default' => 'default' )); } diff --git a/core/modules/system/tests/modules/design_test/design_test.module b/core/modules/system/tests/modules/design_test/design_test.module index 9771ba4..a7ab1b5 100644 --- a/core/modules/system/tests/modules/design_test/design_test.module +++ b/core/modules/system/tests/modules/design_test/design_test.module @@ -98,7 +98,7 @@ function design_test_menu_local_tasks_alter(&$data, $router_item, $root_path) { $actions = &$data['actions']['output']; // Determine the currently selected theme, if any. $selected_theme = drupal_container()->get('request')->query->get('theme'); - $default_theme = variable_get('theme_default', 'stark'); + $default_theme = config('system.theme')->get('default'); // Expand all enabled themes into action links. $themes = list_themes(); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php index 35a65ea..c14a562 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php @@ -25,7 +25,9 @@ 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')); config('system.theme')->set('admin', 'seven')->save(); 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 584ea9b..b67b061 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 @@ -1715,7 +1715,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/modules/views/lib/Drupal/views/Tests/UI/OverrideDisplaysTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/OverrideDisplaysTest.php index b60f9d4..b4fc97a 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/OverrideDisplaysTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/OverrideDisplaysTest.php @@ -54,7 +54,7 @@ function testOverrideDisplays() { $this->assertText($original_title); // Confirm that the view block is available in the block administration UI. - $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . variable_get('theme_default', 'stark') . '/add'); + $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add'); $this->assertText('View: ' . $view['human_name']); // Place the block. @@ -113,7 +113,7 @@ function testWizardMixedDefaultOverriddenDisplays() { $this->assertNoText($view['block[title]']); // Confirm that the block is available in the block administration UI. - $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . variable_get('theme_default', 'stark') . '/add'); + $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add'); $this->assertText('View: ' . $view['human_name']); // Place the block. diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php index b786859..8e15322 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/BasicTest.php @@ -123,7 +123,7 @@ function testViewsWizardAndListing() { $this->assertLinkByHref(url($view3['page[path]'])); // Confirm that the block is available in the block administration UI. - $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . variable_get('theme_default', 'stark') . '/add'); + $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add'); $this->assertText('View: ' . $view3['human_name']); // Place the block. diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php index 16e86fa..51ba883 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/ItemsPerPageTest.php @@ -75,7 +75,7 @@ function testItemsPerPage() { $this->assertTrue($pos5 < $pos4 && $pos4 < $pos3 && $pos3 < $pos2, t('The nodes appear in the expected order in the page display.')); // Confirm that the block is listed in the block administration UI. - $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . variable_get('theme_default', 'stark') . '/add'); + $this->drupalGet('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add'); $this->assertText('View: ' . $view['human_name']); // Place the block, visit a page that displays the block, and check that the // nodes we expect appear in the correct order. diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index 85c818c..13463b9 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -15,7 +15,9 @@ 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 4c1239a..b2fbc90 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -531,12 +531,12 @@ * * The following overrides are examples: * - site_name: Defines the site's name. - * - theme_default: Defines the default theme for this site. + * - $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'; /**