diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc
index ffa0b0b..c7f392b 100644
--- a/core/modules/block/block.admin.inc
+++ b/core/modules/block/block.admin.inc
@@ -311,7 +311,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) {
);
$theme_default = variable_get('theme_default', 'stark');
- $admin_theme = variable_get('admin_theme');
+ $admin_theme = config('system.site')->get('admin_theme');
foreach (list_themes() as $key => $theme) {
// Only display enabled themes
if ($theme->status) {
diff --git a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php
index c133f17..b8a2ef2 100644
--- a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php
@@ -40,7 +40,7 @@ function testNewDefaultThemeBlocks() {
// Ensure no other theme's blocks are in the block table yet.
$themes = array();
$themes['default'] = variable_get('theme_default', 'stark');
- if ($admin_theme = variable_get('admin_theme')) {
+ if ($admin_theme = config('system.site')->get('admin_theme')) {
$themes['admin'] = $admin_theme;
}
$count = db_query_range('SELECT 1 FROM {block} WHERE theme NOT IN (:themes)', 0, 1, array(':themes' => $themes))->fetchField();
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
index f5e33ee..9533a1c 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
@@ -129,7 +129,7 @@ function testRecentNodeBlock() {
$custom_block['types[article]'] = TRUE;
$custom_block['body[value]'] = $this->randomName(32);
$custom_block['regions[' . variable_get('theme_default', 'stark') . ']'] = 'content';
- if ($admin_theme = variable_get('admin_theme')) {
+ if ($admin_theme = config('system.site')->get('admin_theme')) {
$custom_block['regions[' . $admin_theme . ']'] = 'content';
}
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
index ccf9834..ad12639 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
@@ -64,7 +64,7 @@ function testShortcutLinkAdd() {
*/
function testShortcutQuickLink() {
theme_enable(array('seven'));
- variable_set('admin_theme', 'seven');
+ config('system.site')->set('admin_theme', 'seven')->save();
variable_set('node_admin_theme', TRUE);
$this->drupalGet($this->set->links[0]['link_path']);
$this->assertRaw(t('Remove from %title shortcuts', array('%title' => $this->set->title)), '"Add to shortcuts" link properly switched to "Remove from shortcuts".');
diff --git a/core/modules/system/config/system.site.yml b/core/modules/system/config/system.site.yml
index b642dc8..1776d40 100644
--- a/core/modules/system/config/system.site.yml
+++ b/core/modules/system/config/system.site.yml
@@ -1,3 +1,4 @@
+admin_theme: '0'
name: Drupal
mail: ''
slogan: ''
diff --git a/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php b/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php
index db1d671..9be7551 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php
@@ -37,7 +37,7 @@ function testBatchProgressPageTheme() {
// is using a different theme than would normally be used by the batch API.
variable_set('theme_default', 'bartik');
theme_enable(array('seven'));
- variable_set('admin_theme', 'seven');
+ config('system.site')->set('admin_theme', 'seven')->save();
// Log in as an administrator who can see the administrative theme.
$admin_user = $this->drupalCreateUser(array('view the administration theme'));
$this->drupalLogin($admin_user);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
index 3230601..82458d3 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
@@ -38,7 +38,7 @@ function setUp() {
// and administrative theme that they expect.
theme_enable(array('bartik'));
variable_set('theme_default', 'bartik');
- variable_set('admin_theme', 'seven');
+ config('system.site')->set('admin_theme', 'seven')->save();
theme_disable(array('stark'));
// Enable navigation menu block.
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index b8cae7a..b0f5b54 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -120,7 +120,7 @@ function system_themes_page() {
$theme_default = variable_get('theme_default', 'stark');
$theme_groups = array();
- $admin_theme = variable_get('admin_theme', 0);
+ $admin_theme = config('system.site')->get('admin_theme');
foreach ($themes as &$theme) {
if (!empty($theme->info['hidden'])) {
@@ -257,7 +257,7 @@ function system_themes_admin_form($form, &$form_state, $theme_options) {
'#options' => array(0 => t('Default theme')) + $theme_options,
'#title' => t('Administration theme'),
'#description' => t('Choose "Default theme" to always use the same theme as the rest of the site.'),
- '#default_value' => variable_get('admin_theme', 0),
+ '#default_value' => config('system.site')->get('admin_theme'),
);
$form['admin_theme']['actions'] = array('#type' => 'actions');
$form['admin_theme']['actions']['submit'] = array(
@@ -272,7 +272,7 @@ function system_themes_admin_form($form, &$form_state, $theme_options) {
*/
function system_themes_admin_form_submit($form, &$form_state) {
drupal_set_message(t('The configuration options have been saved.'));
- variable_set('admin_theme', $form_state['values']['admin_theme']);
+ config('system.site')->set('admin_theme', $form_state['values']['admin_theme'])->save();
}
/**
@@ -309,7 +309,7 @@ function system_theme_disable() {
// Check if the specified theme is one recognized by the system.
if (!empty($themes[$theme])) {
// Do not disable the default or admin theme.
- if ($theme == variable_get('theme_default', 'stark') || $theme == variable_get('admin_theme', 0)) {
+ if ($theme == variable_get('theme_default', 'stark') || $theme == config('system.site')->get('admin_theme')) {
drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error');
}
else {
@@ -353,8 +353,8 @@ function system_theme_default() {
// The status message depends on whether an admin theme is currently in use:
// a value of 0 means the admin theme is set to be the default theme.
- $admin_theme = variable_get('admin_theme', 0);
- if ($admin_theme != 0 && $admin_theme != $theme) {
+ $admin_theme = config('system.site')->get('admin_theme');
+ if ($admin_theme && $admin_theme != $theme) {
drupal_set_message(t('Please note that the administration theme is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array(
'%admin_theme' => $themes[$admin_theme]->info['name'],
'%selected_theme' => $themes[$theme]->info['name'],
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index be3a6d8..e1e7842 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -2318,6 +2318,17 @@ function system_update_8040() {
}
/**
+ * Converts admin_theme variable to config.
+ *
+ * @ingroup config_upgrade
+ */
+function system_update_8041() {
+ update_variables_to_config('system.site', array(
+ 'admin_theme' => 'admin_theme'
+ ));
+}
+
+/**
* @} End of "defgroup updates-7.x-to-8.x".
* The next series of updates should start at 9000.
*/
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 26fee90..3527735 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -214,7 +214,7 @@ function system_permission() {
),
'view the administration theme' => array(
'title' => t('View the administration theme'),
- 'description' => variable_get('admin_theme') ? '' : t('This is only used when the site is configured to use a separate administration theme on the Appearance page.', array('@appearance-url' => url('admin/appearance'))),
+ 'description' => config('system.site')->get('admin_theme') ?: t('This is only used when the site is configured to use a separate administration theme on the Appearance page.', array('@appearance-url' => url('admin/appearance'))),
),
'access site reports' => array(
'title' => t('View site reports'),
@@ -2394,7 +2394,7 @@ function system_custom_theme() {
$request = drupal_container()->get('request');
$path = $request->attributes->get('system_path');
if (user_access('view the administration theme') && path_is_admin($path)) {
- return variable_get('admin_theme');
+ return config('system.site')->get('admin_theme');
}
}
}
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module
index 5d16e63..f3bd033 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.module
+++ b/core/modules/system/tests/modules/menu_test/menu_test.module
@@ -462,7 +462,7 @@ function menu_test_theme_page_callback($inherited = FALSE) {
function menu_test_theme_callback($argument) {
// Test using the variable administrative theme.
if ($argument == 'use-admin-theme') {
- return variable_get('admin_theme');
+ return config('system.site')->get('admin_theme');
}
// Test using a theme that exists, but may or may not be enabled.
elseif ($argument == 'use-stark-theme') {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php
index b226970..e555bb6 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/ThemeTest.php
@@ -27,7 +27,7 @@ function setUp() {
// the duration of these tests.
variable_set('theme_default', 'bartik');
theme_enable(array('seven'));
- variable_set('admin_theme', 'seven');
+ config('system.site')->set('admin_theme', 'seven')->save();
// Create and log in as a user who has permission to add and edit taxonomy
// terms and view the administrative theme.
diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install
index 071bf31..e2d65f0 100644
--- a/core/profiles/standard/standard.install
+++ b/core/profiles/standard/standard.install
@@ -437,6 +437,6 @@ function standard_install() {
// Enable the admin theme.
theme_enable(array('seven'));
- variable_set('admin_theme', 'seven');
+ config('system.site')->set('admin_theme', 'seven')->save();
variable_set('node_admin_theme', '1');
}