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() {
// 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;
}
}
......
......@@ -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;
......
......@@ -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.
......
......@@ -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) {
......
......@@ -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));
......
......@@ -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 {
......
......@@ -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.
......
......@@ -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.');
......
......@@ -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();
......
......@@ -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.
......
......@@ -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.');
}
......
......@@ -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
......
......@@ -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.');
......
......@@ -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);
......
......@@ -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);
......
......@@ -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.
......
......@@ -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.
......
......@@ -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);
......
......@@ -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.');
......
......@@ -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() {
......
......@@ -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,
);
......
admin: '0'
enabled:
stark: '0'
default: stark
......@@ -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.
......
......@@ -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.
......
......@@ -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');
}
......
......@@ -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');
......
......@@ -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);
......
......@@ -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
......
......@@ -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.');
}
......
......@@ -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.'));
}
......
......@@ -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();
......
......@@ -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.
......
......@@ -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
......
......@@ -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'
));
}
......
......@@ -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();
......
......@@ -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();
......
......@@ -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) {
......
......@@ -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',