diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index d8eb913c7715d61879e7c6429df51358fe58fbc9..212dff60babab00ab181878074e3c0b06764ca1a 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 cc60af2482501a0230e8ebfc1bb64fc208dfce27..305156043e6b938941ca71ad459232ce20c597af 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 0b426e210a58d65c01bee1eecd775365ae82c24e..a03722a7f516ceed43a898f39c32a4896ba91aaa 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 e5e8d7641cddc4077ea682b79ff9ba8cff283f66..eab2d8d0b966afc81fb0dd6941bed23b202c3623 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 ff804b24672976d2f131367bbe8c8c7b64d447b9..97ad2d25ed0d59d7e2e1fb6f9089ae31381854b2 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -59,7 +59,7 @@ function block_help($path, $arg) { $output .= '<dd>' . t('Blocks can be configured to be visible only on certain pages, only to users of certain roles, or only on pages displaying certain <a href="@content-type">content types</a>. 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'))) . '</dd>'; if (module_exists('custom_block')) { $output .= '<dt>' . t('Creating custom blocks') . '</dt>'; - $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can <a href="@block-add">add custom blocks</a>, which are then listed on the <a href="@blocks">Blocks administration page</a>. 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'))) . '</dd>'; + $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can <a href="@block-add">add custom blocks</a>, which are then listed on the <a href="@blocks">Blocks administration page</a>. 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'))) . '</dd>'; } $output .= '</dl>'; 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 = '<p>' . 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 <em>Save blocks</em> button at the bottom of the page. Click the <em>configure</em> link next to each block to configure its specific title and visibility settings.') . '</p>'; @@ -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 ccc7eca26d6bc8b3479a5280a197c80102ab1b16..0094c429613c445d60c4d180d840e310acc2e916 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 c16439c3efce92ed7e42c4f6ac60478a628ccb8f..1232420fa562dd0a1804842252e5eaee1cd656b8 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 16531dfcb7291ac4c7cf78bf0e6ec35cacde1ce9..f24764825a4f05d18d77c4c631a9748e31535007 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 c469eb6c4952e952e2ceba85601e7a1c62c92beb..d707c8046843d051b9abad26797d2cae1618e12b 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 38a0d2983208cc478d2bd7ca133dc17af14fd2fa..60be77889994c3f9817c774e771f166311ebfd2a 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 41f7a14e1d075b7941ccf625c1db5c0200f42c46..b04f9fccf52e18f74a78183d01298453d79a7dc5 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('<script>alert("XSS label");</script>', '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("<script>alert('XSS subject');</script>", '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 190570c0b8bc4ea5629bf844d1d013bea03dd3a8..f9a77923779cf67eba0507dd158a7ece1ada648e 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 b91bdcf2e37f66b7eb04ebb7889b77f6ac67ba32..5f3b776fb17106ed817d2ff46914563d6df504fc 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 c566f3a203fe279ee3abe92efed133f7d2e0e0b2..2b1358f8dc3bdf7f341718e0e1cd558638b8c5e3 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 6720e04a922f26363cd6753e7dc0efc6b172727a..fea56861c7f0012d4e879e140f351c4adc6db37e 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 91cab48acacd2b46f94dc5cd97d2da00cee70bc9..8deb4e3500f6f46e4d72516467880377eebd3140 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 88283cc2a85e63897379ba9028c0630ec2d94582..9f4dcc640475573ddb83f4bdf6805b04f688a4c5 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 8e885e40fb6b4d4e9366a0e2c286315588de0156..83f0b6699b7cb7059d01b8cc38a3ab16ce1a930c 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 fc953e5b30f815057bdca651704bdbe6bf5a34a0..ca1d88b1be42f980b2827b92d4e1afc47656e42d 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 6dbf439c64bcfc2680a3602b3972d9a4949723fe..bc472c4db666b356c6324e9b5f2316f0502f17c1 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 dce2ceb464a2efaeb4933c5757ac2c06ccde4410..4aa90322f6a921ae86d704909ccaa282c8b974c8 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 cf330e1840dadfc2e106f1a3dd097809dbc55d98..c56c7f2b4977bb0f7e8aa16f38897f85705b4a81 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 e7aa0e04a6c170d5855ae99af4cb4f968aea5261..f8944f907ff9b56fe7bece487c993dfe6fec7de0 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 97593f23cdb74792c879dbc73714ce772036dce5..be6bcef57226969ae5d5305dffdb745935e6bc9d 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 39494fd2565d362d7600245b4e833eab5142a472..7a0eb1fa6c3181ba0fbd0c6ca2cc068d20d3ddf5 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 8cf14d5fffaa4786bf113b7f109602a444ccc0c9..f636849f4ae822ce4d77a6899937ac47a2abb507 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 27f3e6ab28494b700978796a90207a357523b007..354555384fda0cab32c6a06a3c3f16f798a7a216 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 c2b6c43eb31a37e1265ccfe62bd8b9a7cae9d43c..54ee1d2281844e671252c70eb4bbf4f9786af2d5 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 6e9b383a21565217bdf1074270979aee66fdd4ed..ce5f96a52f329c46ebaef93243355a5edaca0fed 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 13b649c8d3e9fc6ea92d6a21d2b11e49425c3b79..c62f7c3115befc63fa816fea5f2ec02eaaaada34 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 401e02165651298ce1bb6890e9a2784cfc7cbccf..0bcd1a6bdb33f09813abf5fff779b3a2ccaa0373 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 36033bdbeaa3dde8f28f0e85e364fa80a7b55cfe..b9129e36683ef7272056eb73655678e97e0fbca8 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 a2c7011d51844c445e77f00d3bcef539be3b94d1..b367033633d2680eca6bb95752d525510f6e19f0 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 daac6bade694ca40d246d1d4ce92af7621999d63..c21d62a5019ee58b02562b9a89748a58a8cabe47 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 9771ba49089fe4ebfde9e51f8242075b4a0dedc3..a7ab1b512fa85e315e866c7fa7f9e6c57b9a83b6 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 35a65ea12ec0acb36abfda54ecc514cb5b057e9c..c14a5626ee491ede6655646bbb8d60a2eab0a383 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 8da5f600e63ff81a9a3b8f2327651197ab33b642..ea0c954b289f40b2107a644f5248f2587efe36be 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 b60f9d49a717543949228673625a5e944741d3c6..b4fc97a4931115d327c847720d3edf34f1cf9ecc 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 b786859546e94f19c3ebe880b5ab1a50e8d91cb1..8e153222529b6062e1c82c3cac6dfe88e25fad24 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 16e86fa5a4d8a3404465f21e0af3ae7a979695fc..51ba88339a39fd0c1c7e6fa3118545dba4b0d46f 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 85c818cdd88776df648897bb9acca5ce8124e26f..13463b99feb7283b4073fd2902f10088ca921e7d 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 4c1239ab2493023451b19536424017bf94dc161d..b2fbc90868481b5f58ae8f07b4371007af35def7 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'; /**