Commit f8899fb6 authored by catch's avatar catch

Issue #1829224 by alexpott, pfrenssen, vijaycs85, lirantal: Convert the...

Issue #1829224 by alexpott, pfrenssen, vijaycs85, lirantal: Convert the 'theme_default()' variable to CMI.
parent 17e71a44
...@@ -411,7 +411,7 @@ function ajax_base_page_theme() { ...@@ -411,7 +411,7 @@ function ajax_base_page_theme() {
// to see the default theme, token validation isn't required for that, and // 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 // bypassing it allows most use-cases to work even when accessed from the
// page cache. // 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; return $theme;
} }
} }
......
...@@ -90,7 +90,7 @@ function drupal_theme_initialize() { ...@@ -90,7 +90,7 @@ function drupal_theme_initialize() {
// Only select the user selected theme if it is available in the // Only select the user selected theme if it is available in the
// list of themes that can be accessed. // 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 // 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. // inside menu_get_custom_theme(), so we do not need to check it again here.
...@@ -1530,7 +1530,7 @@ function theme_enable($theme_list) { ...@@ -1530,7 +1530,7 @@ function theme_enable($theme_list) {
*/ */
function theme_disable($theme_list) { function theme_disable($theme_list) {
// Don't disable the default theme. // 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]); unset($theme_list[$pos]);
if (empty($theme_list)) { if (empty($theme_list)) {
return; return;
......
...@@ -50,7 +50,7 @@ function _drupal_maintenance_theme() { ...@@ -50,7 +50,7 @@ function _drupal_maintenance_theme() {
// Stark otherwise. Since there is no low-level access to configuration // Stark otherwise. Since there is no low-level access to configuration
// currently, we only consult settings.php and fall back to Bartik // currently, we only consult settings.php and fall back to Bartik
// otherwise, as it looks generic enough and way more user-friendly. // 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. // Ensure that system.module is loaded.
......
...@@ -70,7 +70,7 @@ function block_admin_edit(Block $entity) { ...@@ -70,7 +70,7 @@ function block_admin_edit(Block $entity) {
$theme = $themes[$theme_key]; $theme = $themes[$theme_key];
// Use meaningful titles for the main site and administrative themes. // Use meaningful titles for the main site and administrative themes.
$theme_title = $theme->info['name']; $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)); $theme_title = t('!theme (default theme)', array('!theme' => $theme_title));
} }
elseif ($admin_theme && $theme_key == $admin_theme) { elseif ($admin_theme && $theme_key == $admin_theme) {
......
...@@ -59,7 +59,7 @@ function block_help($path, $arg) { ...@@ -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>'; $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')) { if (module_exists('custom_block')) {
$output .= '<dt>' . t('Creating custom blocks') . '</dt>'; $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>'; $output .= '</dl>';
return $output; return $output;
...@@ -69,7 +69,7 @@ function block_help($path, $arg) { ...@@ -69,7 +69,7 @@ function block_help($path, $arg) {
list(, $demo_theme) = explode(':', $arg[4]); list(, $demo_theme) = explode(':', $arg[4]);
} }
else { else {
$demo_theme = variable_get('theme_default', 'stark'); $demo_theme = config('system.theme')->get('default');
} }
$themes = list_themes(); $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>'; $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() { ...@@ -112,7 +112,7 @@ function block_permission() {
* @todo Clarify the documentation for the per-plugin block admin links. * @todo Clarify the documentation for the per-plugin block admin links.
*/ */
function block_menu() { function block_menu() {
$default_theme = variable_get('theme_default', 'stark'); $default_theme = config('system.theme')->get('default');
$items['admin/structure/block'] = array( $items['admin/structure/block'] = array(
'title' => 'Blocks', 'title' => 'Blocks',
'description' => 'Configure what block content appears in your site\'s sidebars and other regions.', 'description' => 'Configure what block content appears in your site\'s sidebars and other regions.',
...@@ -267,7 +267,7 @@ function block_page_build(&$page) { ...@@ -267,7 +267,7 @@ function block_page_build(&$page) {
$page['page_top']['backlink'] = array( $page['page_top']['backlink'] = array(
'#type' => 'link', '#type' => 'link',
'#title' => t('Exit block region demonstration'), '#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 // Add the "overlay-restore" class to indicate this link should restore
// the context in which the region demonstration page was opened. // the context in which the region demonstration page was opened.
'#options' => array('attributes' => array('class' => array('block-demo-backlink', 'overlay-restore'))), '#options' => array('attributes' => array('class' => array('block-demo-backlink', 'overlay-restore'))),
...@@ -363,7 +363,7 @@ function _block_get_renderable_region($list = array()) { ...@@ -363,7 +363,7 @@ function _block_get_renderable_region($list = array()) {
* Blocks currently exported by modules. * Blocks currently exported by modules.
*/ */
function _block_rehash($theme = NULL) { 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); $regions = system_region_list($theme);
$blocks = entity_load_multiple_by_properties('block', array('theme' => $theme)); $blocks = entity_load_multiple_by_properties('block', array('theme' => $theme));
foreach ($blocks as $block_id => $block) { foreach ($blocks as $block_id => $block) {
...@@ -412,7 +412,7 @@ function block_theme_initialize($theme) { ...@@ -412,7 +412,7 @@ function block_theme_initialize($theme) {
// Initialize theme's blocks if none already registered. // Initialize theme's blocks if none already registered.
$has_blocks = entity_load_multiple_by_properties('block', array('theme' => $theme)); $has_blocks = entity_load_multiple_by_properties('block', array('theme' => $theme));
if (!$has_blocks) { 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. // Apply only to new theme's visible regions.
$regions = system_region_list($theme, REGIONS_VISIBLE); $regions = system_region_list($theme, REGIONS_VISIBLE);
$default_theme_blocks = entity_load_multiple_by_properties('block', array('theme' => $default_theme)); $default_theme_blocks = entity_load_multiple_by_properties('block', array('theme' => $default_theme));
......
...@@ -182,7 +182,7 @@ public function save(array $form, array &$form_state) { ...@@ -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; $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . $theme;
} }
else { 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 { else {
......
...@@ -61,7 +61,9 @@ public function testBlockNotInHiddenRegion() { ...@@ -61,7 +61,9 @@ public function testBlockNotInHiddenRegion() {
// Enable "block_test_theme" and set it as the default theme. // Enable "block_test_theme" and set it as the default theme.
$theme = 'block_test_theme'; $theme = 'block_test_theme';
theme_enable(array($theme)); theme_enable(array($theme));
variable_set('theme_default', $theme); config('system.theme')
->set('default', $theme)
->save();
menu_router_rebuild(); menu_router_rebuild();
// Ensure that "block_test_theme" is set as the default theme. // Ensure that "block_test_theme" is set as the default theme.
......
...@@ -54,7 +54,7 @@ function setUp() { ...@@ -54,7 +54,7 @@ function setUp() {
*/ */
public function testLanguageBlockVisibility() { public function testLanguageBlockVisibility() {
// Check if the visibility setting is available. // 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->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme);
$this->assertField('visibility[language][langcodes][en]', 'Language visibility field is visible.'); $this->assertField('visibility[language][langcodes][en]', 'Language visibility field is visible.');
......
...@@ -40,7 +40,7 @@ function testBlockThemeHookSuggestions() { ...@@ -40,7 +40,7 @@ function testBlockThemeHookSuggestions() {
$block = entity_create('block', array( $block = entity_create('block', array(
'plugin' => 'system_menu_block:menu-admin', 'plugin' => 'system_menu_block:menu-admin',
'region' => 'footer', 'region' => 'footer',
'id' => variable_get('theme_default', 'stark') . '.machinename', 'id' => config('system.theme')->get('default') . '.machinename',
)); ));
$variables = array(); $variables = array();
......
...@@ -65,7 +65,7 @@ function setUp() { ...@@ -65,7 +65,7 @@ function setUp() {
* Test creating custom block, moving it to a specific region and then deleting it. * Test creating custom block, moving it to a specific region and then deleting it.
*/ */
public function testCustomBlock() { 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. // Clear the block cache to load the Custom Block module's block definitions.
$this->container->get('plugin.manager.block')->clearCachedDefinitions(); $this->container->get('plugin.manager.block')->clearCachedDefinitions();
...@@ -150,7 +150,7 @@ public function testCustomBlock() { ...@@ -150,7 +150,7 @@ public function testCustomBlock() {
* Test creating custom block using Full HTML. * Test creating custom block using Full HTML.
*/ */
public function testCustomBlockFormat() { 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. // Add a new custom block by filling out the input form on block/add/basic.
$info = strtolower($this->randomName(8)); $info = strtolower($this->randomName(8));
...@@ -200,7 +200,7 @@ function testBlockVisibility() { ...@@ -200,7 +200,7 @@ function testBlockVisibility() {
// Create a random title for the block. // Create a random title for the block.
$title = $this->randomName(8); $title = $this->randomName(8);
// Enable a standard block. // Enable a standard block.
$default_theme = variable_get('theme_default', 'stark'); $default_theme = config('system.theme')->get('default');
$edit = array( $edit = array(
'machine_name' => strtolower($this->randomName(8)), 'machine_name' => strtolower($this->randomName(8)),
'region' => 'sidebar_first', 'region' => 'sidebar_first',
...@@ -240,7 +240,7 @@ function testBlockVisibilityListedEmpty() { ...@@ -240,7 +240,7 @@ function testBlockVisibilityListedEmpty() {
// Create a random title for the block. // Create a random title for the block.
$title = $this->randomName(8); $title = $this->randomName(8);
// Enable a standard block. // Enable a standard block.
$default_theme = variable_get('theme_default', 'stark'); $default_theme = config('system.theme')->get('default');
$edit = array( $edit = array(
'machine_name' => strtolower($this->randomName(8)), 'machine_name' => strtolower($this->randomName(8)),
'region' => 'sidebar_first', 'region' => 'sidebar_first',
...@@ -273,7 +273,7 @@ function testBlock() { ...@@ -273,7 +273,7 @@ function testBlock() {
$block['id'] = 'system_powered_by_block'; $block['id'] = 'system_powered_by_block';
$block['label'] = $this->randomName(8); $block['label'] = $this->randomName(8);
$block['machine_name'] = strtolower($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'; $block['region'] = 'header';
// Set block title to confirm that interface works and override any custom titles. // Set block title to confirm that interface works and override any custom titles.
...@@ -320,7 +320,7 @@ function testBlock() { ...@@ -320,7 +320,7 @@ function testBlock() {
*/ */
function moveBlockToRegion(array $block, $region) { function moveBlockToRegion(array $block, $region) {
// Set the created block to a specific 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 = array();
$edit['blocks[' . $block['theme'] . '.' . $block['machine_name'] . '][region]'] = $region; $edit['blocks[' . $block['theme'] . '.' . $block['machine_name'] . '][region]'] = $region;
$this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
...@@ -354,7 +354,7 @@ function testBlockRehash() { ...@@ -354,7 +354,7 @@ function testBlockRehash() {
$block = array(); $block = array();
$block['id'] = 'test_cache'; $block['id'] = 'test_cache';
$block['machine_name'] = strtolower($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'; $block['region'] = 'header';
$block = $this->drupalPlaceBlock('test_cache', array('region' => 'header')); $block = $this->drupalPlaceBlock('test_cache', array('region' => 'header'));
...@@ -413,7 +413,7 @@ function testBlockModuleDisable() { ...@@ -413,7 +413,7 @@ function testBlockModuleDisable() {
} }
// Ensure that the disabled module's block plugin is no longer available. // 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')); $this->assertNoText(t('Test block caching'));
// Confirm that the block is no longer displayed on the front page. // Confirm that the block is no longer displayed on the front page.
......
...@@ -47,7 +47,7 @@ function testXSSInTitle() { ...@@ -47,7 +47,7 @@ function testXSSInTitle() {
$this->assertNoRaw('<script>alert("XSS label");</script>', 'The block title was properly sanitized when rendered.'); $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'))); $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->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.'); $this->assertNoRaw("<script>alert('XSS subject');</script>", 'The block title was properly sanitized in Block Plugin UI Admin page.');
} }
......
...@@ -33,7 +33,7 @@ public static function getInfo() { ...@@ -33,7 +33,7 @@ public static function getInfo() {
* Check the enabled Bartik blocks are correctly copied over. * Check the enabled Bartik blocks are correctly copied over.
*/ */
function testNewDefaultThemeBlocks() { function testNewDefaultThemeBlocks() {
$default_theme = variable_get('theme_default', 'stark'); $default_theme = config('system.theme')->get('default');
// Add several block instances. // Add several block instances.
$this->adminUser = $this->drupalCreateUser(array('administer blocks')); $this->adminUser = $this->drupalCreateUser(array('administer blocks'));
...@@ -51,7 +51,9 @@ function testNewDefaultThemeBlocks() { ...@@ -51,7 +51,9 @@ function testNewDefaultThemeBlocks() {
$new_theme = 'bartik'; $new_theme = 'bartik';
$this->assertFalse($new_theme == $default_theme, 'The new theme is different from the previous default theme.'); $this->assertFalse($new_theme == $default_theme, 'The new theme is different from the previous default theme.');
theme_enable(array($new_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. // Ensure that the new theme has all the blocks as the previous default.
// @todo Replace the string manipulation below once the configuration // @todo Replace the string manipulation below once the configuration
......
...@@ -142,7 +142,7 @@ protected function testDeleteBlockDisplay() { ...@@ -142,7 +142,7 @@ protected function testDeleteBlockDisplay() {
*/ */
public function testViewsBlockForm() { public function testViewsBlockForm() {
$this->drupalLogin($this->drupalCreateUser(array('administer blocks'))); $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); $this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme);
$elements = $this->xpath('//input[@name="label"]'); $elements = $this->xpath('//input[@name="label"]');
$this->assertTrue(empty($elements), 'The label field is not found for Views blocks.'); $this->assertTrue(empty($elements), 'The label field is not found for Views blocks.');
......
...@@ -97,7 +97,7 @@ function ckeditor_theme() { ...@@ -97,7 +97,7 @@ function ckeditor_theme() {
function _ckeditor_theme_css($theme = NULL) { function _ckeditor_theme_css($theme = NULL) {
$css = array(); $css = array();
if (!isset($theme)) { if (!isset($theme)) {
$theme = variable_get('theme_default'); $theme = config('system.theme')->get('default');
} }
if ($theme_path = drupal_get_path('theme', $theme)) { if ($theme_path = drupal_get_path('theme', $theme)) {
$info = system_get_info('theme', $theme); $info = system_get_info('theme', $theme);
......
...@@ -76,7 +76,9 @@ function testColor() { ...@@ -76,7 +76,9 @@ function testColor() {
* Tests the Color module functionality using the given theme. * Tests the Color module functionality using the given theme.
*/ */
function _testColor($theme, $test_values) { function _testColor($theme, $test_values) {
variable_set('theme_default', $theme); config('system.theme')
->set('default', $theme)
->save();
$settings_path = 'admin/appearance/settings/' . $theme; $settings_path = 'admin/appearance/settings/' . $theme;
$this->drupalLogin($this->big_user); $this->drupalLogin($this->big_user);
...@@ -122,7 +124,9 @@ function _testColor($theme, $test_values) { ...@@ -122,7 +124,9 @@ function _testColor($theme, $test_values) {
* Tests whether the provided color is valid. * Tests whether the provided color is valid.
*/ */
function testValidColor() { function testValidColor() {
variable_set('theme_default', 'bartik'); config('system.theme')
->set('default', 'bartik')
->save();
$settings_path = 'admin/appearance/settings/bartik'; $settings_path = 'admin/appearance/settings/bartik';
$this->drupalLogin($this->big_user); $this->drupalLogin($this->big_user);
......
...@@ -35,7 +35,9 @@ public static function getInfo() { ...@@ -35,7 +35,9 @@ public static function getInfo() {
function testCommentLinks() { function testCommentLinks() {
// Bartik theme alters comment links, so use a different theme. // Bartik theme alters comment links, so use a different theme.
theme_enable(array('stark')); 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(), // Remove additional user permissions from $this->web_user added by setUp(),
// since this test is limited to anonymous and authenticated roles only. // since this test is limited to anonymous and authenticated roles only.
......
...@@ -157,7 +157,7 @@ function addCustomMenu() { ...@@ -157,7 +157,7 @@ function addCustomMenu() {
// Enable the custom menu block. // Enable the custom menu block.
$menu_name = 'menu-' . $menu_name; // Drupal prepends the name with 'menu-'. $menu_name = 'menu-' . $menu_name; // Drupal prepends the name with 'menu-'.
// Confirm that the custom menu block is available. // 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); $this->assertText($label);
// Enable the block. // Enable the block.
......
...@@ -61,16 +61,16 @@ function php_permission() { ...@@ -61,16 +61,16 @@ function php_permission() {
* @see php_filter_info() * @see php_filter_info()
*/ */
function php_eval($code) { function php_eval($code) {
global $theme_path, $theme_info, $conf; global $theme_path, $theme_info;
// Store current theme path. // Store current theme path.
$old_theme_path = $theme_path; $old_theme_path = $theme_path;
// Restore theme_path to the theme, as long as php_eval() executes, // 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. // 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)) { 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 { else {
$theme_path = dirname($theme_info->filename); $theme_path = dirname($theme_info->filename);
......
...@@ -136,7 +136,9 @@ function testShortcutLinkDelete() { ...@@ -136,7 +136,9 @@ function testShortcutLinkDelete() {
*/ */
function testNoShortcutLink() { function testNoShortcutLink() {
// Change to a theme that displays shortcuts. // 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->drupalGet('page-that-does-not-exist');
$this->assertNoRaw('add-shortcut', 'Add to shortcuts link was not shown on a page not found.'); $this->assertNoRaw('add-shortcut', 'Add to shortcuts link was not shown on a page not found.');
......
...@@ -119,6 +119,8 @@ protected function setUp() { ...@@ -119,6 +119,8 @@ protected function setUp() {
$modules = array_reverse($modules); $modules = array_reverse($modules);
$modules = call_user_func_array('array_merge_recursive', $modules); $modules = call_user_func_array('array_merge_recursive', $modules);
$this->enableModules($modules, FALSE); $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() { protected function tearDown() {
......
...@@ -376,7 +376,7 @@ protected function drupalPlaceBlock($plugin_id, array $values = array(), array $ ...@@ -376,7 +376,7 @@ protected function drupalPlaceBlock($plugin_id, array $values = array(), array $
'plugin' => $plugin_id, 'plugin' => $plugin_id,
'label' => $this->randomName(8), 'label' => $this->randomName(8),
'region' => 'sidebar_first', 'region' => 'sidebar_first',
'theme' => variable_get('theme_default', 'stark'), 'theme' => config('system.theme')->get('default'),
'machine_name' => strtolower($this->randomName(8)), 'machine_name' => strtolower($this->randomName(8)),
'settings' => $settings, 'settings' => $settings,
); );
......
admin: '0' admin: '0'
enabled: enabled:
stark: '0' stark: '0'
default: stark
...@@ -157,7 +157,9 @@ function testLazyLoadOverriddenCSS() { ...@@ -157,7 +157,9 @@ function testLazyLoadOverriddenCSS() {
// The test theme overrides system.base.css without an implementation, // The test theme overrides system.base.css without an implementation,
// thereby removing it. // thereby removing it.
theme_enable(array('test_theme')); 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 // 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. // adding markup to the HEAD and BODY for any lazy loaded JS/CSS files.
......
...@@ -35,7 +35,9 @@ public static function getInfo() { ...@@ -35,7 +35,9 @@ public static function getInfo() {
function testBatchProgressPageTheme() { function testBatchProgressPageTheme() {
// Make sure that the page which starts the batch (an administrative page) // 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. // 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')); theme_enable(array('seven'));
config('system.theme')->set('admin', 'seven')->save(); config('system.theme')->set('admin', 'seven')->save();
// Log in as an administrator who can see the administrative theme. // Log in as an administrator who can see the administrative theme.
......
...@@ -60,8 +60,10 @@ function setUp() { ...@@ -60,8 +60,10 @@ function setUp() {
$this->admin_theme = 'seven'; $this->admin_theme = 'seven';
$this->alternate_theme = 'stark'; $this->alternate_theme = 'stark';
theme_enable(array($this->default_theme)); theme_enable(array($this->default_theme));
variable_set('theme_default', $this->default_theme); config('system.theme')
config('system.theme')->set('admin', $this->admin_theme)->save(); ->set('default', $this->default_theme)
->set('admin', $this->admin_theme)
->save();
theme_disable(array($this->alternate_theme)); theme_disable(array($this->alternate_theme));