Issue #1798872 by : follow-up, move admin theme to system.theme configuration object.

8.0.x
catch 2012-12-10 12:35:52 +00:00
parent a61ace041d
commit 4b9fec43cd
14 changed files with 19 additions and 19 deletions

View File

@ -312,7 +312,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) {
); );
$theme_default = variable_get('theme_default', 'stark'); $theme_default = variable_get('theme_default', 'stark');
$admin_theme = config('system.site')->get('admin_theme'); $admin_theme = config('system.theme')->get('admin');
foreach (list_themes() as $key => $theme) { foreach (list_themes() as $key => $theme) {
// Only display enabled themes // Only display enabled themes
if ($theme->status) { if ($theme->status) {

View File

@ -40,7 +40,7 @@ class NewDefaultThemeBlocksTest extends WebTestBase {
// Ensure no other theme's blocks are in the block table yet. // Ensure no other theme's blocks are in the block table yet.
$themes = array(); $themes = array();
$themes['default'] = variable_get('theme_default', 'stark'); $themes['default'] = variable_get('theme_default', 'stark');
if ($admin_theme = config('system.site')->get('admin_theme')) { if ($admin_theme = config('system.theme')->get('admin')) {
$themes['admin'] = $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(); $count = db_query_range('SELECT 1 FROM {block} WHERE theme NOT IN (:themes)', 0, 1, array(':themes' => $themes))->fetchField();

View File

@ -129,7 +129,7 @@ class NodeBlockFunctionalTest extends NodeTestBase {
$custom_block['types[article]'] = TRUE; $custom_block['types[article]'] = TRUE;
$custom_block['body[value]'] = $this->randomName(32); $custom_block['body[value]'] = $this->randomName(32);
$custom_block['regions[' . variable_get('theme_default', 'stark') . ']'] = 'content'; $custom_block['regions[' . variable_get('theme_default', 'stark') . ']'] = 'content';
if ($admin_theme = config('system.site')->get('admin_theme')) { if ($admin_theme = config('system.theme')->get('admin')) {
$custom_block['regions[' . $admin_theme . ']'] = 'content'; $custom_block['regions[' . $admin_theme . ']'] = 'content';
} }
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block')); $this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));

View File

@ -64,7 +64,7 @@ class ShortcutLinksTest extends ShortcutTestBase {
*/ */
function testShortcutQuickLink() { function testShortcutQuickLink() {
theme_enable(array('seven')); theme_enable(array('seven'));
config('system.site')->set('admin_theme', 'seven')->save(); config('system.theme')->set('admin', 'seven')->save();
variable_set('node_admin_theme', TRUE); variable_set('node_admin_theme', TRUE);
$this->drupalGet($this->set->links[0]['link_path']); $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".'); $this->assertRaw(t('Remove from %title shortcuts', array('%title' => $this->set->title)), '"Add to shortcuts" link properly switched to "Remove from shortcuts".');

View File

@ -1,4 +1,3 @@
admin_theme: '0'
name: Drupal name: Drupal
mail: '' mail: ''
slogan: '' slogan: ''

View File

@ -1,2 +1,3 @@
admin: '0'
enabled: enabled:
stark: '0' stark: '0'

View File

@ -37,7 +37,7 @@ class PageTest extends WebTestBase {
// 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'); variable_set('theme_default', 'bartik');
theme_enable(array('seven')); theme_enable(array('seven'));
config('system.site')->set('admin_theme', '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.
$admin_user = $this->drupalCreateUser(array('view the administration theme')); $admin_user = $this->drupalCreateUser(array('view the administration theme'));
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);

View File

@ -38,7 +38,7 @@ class RouterTest extends WebTestBase {
// and administrative theme that they expect. // and administrative theme that they expect.
theme_enable(array('bartik')); theme_enable(array('bartik'));
variable_set('theme_default', 'bartik'); variable_set('theme_default', 'bartik');
config('system.site')->set('admin_theme', 'seven')->save(); config('system.theme')->set('admin', 'seven')->save();
theme_disable(array('stark')); theme_disable(array('stark'));
// Enable navigation menu block. // Enable navigation menu block.

View File

@ -120,7 +120,7 @@ function system_themes_page() {
$theme_default = variable_get('theme_default', 'stark'); $theme_default = variable_get('theme_default', 'stark');
$theme_groups = array(); $theme_groups = array();
$admin_theme = config('system.site')->get('admin_theme'); $admin_theme = config('system.theme')->get('admin');
foreach ($themes as &$theme) { foreach ($themes as &$theme) {
if (!empty($theme->info['hidden'])) { 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, '#options' => array(0 => t('Default theme')) + $theme_options,
'#title' => t('Administration theme'), '#title' => t('Administration theme'),
'#description' => t('Choose "Default theme" to always use the same theme as the rest of the site.'), '#description' => t('Choose "Default theme" to always use the same theme as the rest of the site.'),
'#default_value' => config('system.site')->get('admin_theme'), '#default_value' => config('system.theme')->get('admin'),
); );
$form['admin_theme']['actions'] = array('#type' => 'actions'); $form['admin_theme']['actions'] = array('#type' => 'actions');
$form['admin_theme']['actions']['submit'] = array( $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) { function system_themes_admin_form_submit($form, &$form_state) {
drupal_set_message(t('The configuration options have been saved.')); drupal_set_message(t('The configuration options have been saved.'));
config('system.site')->set('admin_theme', $form_state['values']['admin_theme'])->save(); config('system.theme')->set('admin', $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. // Check if the specified theme is one recognized by the system.
if (!empty($themes[$theme])) { if (!empty($themes[$theme])) {
// Do not disable the default or admin theme. // Do not disable the default or admin theme.
if ($theme == variable_get('theme_default', 'stark') || $theme == config('system.site')->get('admin_theme')) { if ($theme == variable_get('theme_default', 'stark') || $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'); drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error');
} }
else { else {
@ -353,7 +353,7 @@ function system_theme_default() {
// The status message depends on whether an admin theme is currently in use: // 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. // a value of 0 means the admin theme is set to be the default theme.
$admin_theme = config('system.site')->get('admin_theme'); $admin_theme = config('system.theme')->get('admin');
if ($admin_theme != 0 && $admin_theme != $theme) { if ($admin_theme != 0 && $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( 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'], '%admin_theme' => $themes[$admin_theme]->info['name'],

View File

@ -2325,8 +2325,8 @@ function system_update_8040() {
* @ingroup config_upgrade * @ingroup config_upgrade
*/ */
function system_update_8041() { function system_update_8041() {
update_variables_to_config('system.site', array( update_variables_to_config('system.theme', array(
'admin_theme' => 'admin_theme' 'admin_theme' => 'admin'
)); ));
} }

View File

@ -214,7 +214,7 @@ function system_permission() {
), ),
'view the administration theme' => array( 'view the administration theme' => array(
'title' => t('View the administration theme'), 'title' => t('View the administration theme'),
'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 <a href="@appearance-url">Appearance</a> page.', array('@appearance-url' => url('admin/appearance'))), 'description' => config('system.theme')->get('admin') ?: t('This is only used when the site is configured to use a separate administration theme on the <a href="@appearance-url">Appearance</a> page.', array('@appearance-url' => url('admin/appearance'))),
), ),
'access site reports' => array( 'access site reports' => array(
'title' => t('View site reports'), 'title' => t('View site reports'),
@ -2394,7 +2394,7 @@ function system_custom_theme() {
$request = drupal_container()->get('request'); $request = drupal_container()->get('request');
$path = $request->attributes->get('system_path'); $path = $request->attributes->get('system_path');
if (user_access('view the administration theme') && path_is_admin($path)) { if (user_access('view the administration theme') && path_is_admin($path)) {
return config('system.site')->get('admin_theme'); return config('system.theme')->get('admin');
} }
} }
} }

View File

@ -462,7 +462,7 @@ function menu_test_theme_page_callback($inherited = FALSE) {
function menu_test_theme_callback($argument) { function menu_test_theme_callback($argument) {
// Test using the variable administrative theme. // Test using the variable administrative theme.
if ($argument == 'use-admin-theme') { if ($argument == 'use-admin-theme') {
return config('system.site')->get('admin_theme'); return config('system.theme')->get('admin');
} }
// Test using a theme that exists, but may or may not be enabled. // Test using a theme that exists, but may or may not be enabled.
elseif ($argument == 'use-stark-theme') { elseif ($argument == 'use-stark-theme') {

View File

@ -27,7 +27,7 @@ class ThemeTest extends TaxonomyTestBase {
// the duration of these tests. // the duration of these tests.
variable_set('theme_default', 'bartik'); variable_set('theme_default', 'bartik');
theme_enable(array('seven')); theme_enable(array('seven'));
config('system.site')->set('admin_theme', 'seven')->save(); config('system.theme')->set('admin', 'seven')->save();
// Create and log in as a user who has permission to add and edit taxonomy // Create and log in as a user who has permission to add and edit taxonomy
// terms and view the administrative theme. // terms and view the administrative theme.

View File

@ -437,6 +437,6 @@ function standard_install() {
// Enable the admin theme. // Enable the admin theme.
theme_enable(array('seven')); theme_enable(array('seven'));
config('system.site')->set('admin_theme', 'seven')->save(); config('system.theme')->set('admin', 'seven')->save();
variable_set('node_admin_theme', '1'); variable_set('node_admin_theme', '1');
} }