Commit cf98e43a authored by catch's avatar catch

Issue #2066145 by mtift: Convert node_admin_theme() to the configuration system.

parent ec9b2e80
......@@ -272,7 +272,7 @@ function _book_node_is_removable(EntityInterface $node) {
* Implements hook_admin_paths().
*/
function book_admin_paths() {
if (variable_get('node_admin_theme')) {
if (Drupal::config('node.settings')->get('use_admin_theme')) {
$paths = array(
'node/*/outline' => TRUE,
'node/*/outline/remove' => TRUE,
......
......@@ -7,6 +7,9 @@ node.settings:
items_per_page:
type: integer
label: 'Number of posts on front page'
use_admin_theme:
type: boolean
label: 'Use admin theme when editing or creating content'
node.type.*:
type: mapping
......
......@@ -430,7 +430,6 @@ function node_uninstall() {
// Delete remaining general module variables.
Drupal::state()->delete('node.node_access_needs_rebuild');
variable_del('node_admin_theme');
variable_del('node_recent_block_count');
// Delete any stored state.
......@@ -1114,6 +1113,17 @@ function node_update_8020() {
Drupal::state()->set('node.type.locked', $locked);
}
/**
* Converts node_admin_theme variable to config.
*
* @ingroup config_upgrade
*/
function node_update_8021() {
update_variables_to_config('node.settings', array(
'node_admin_theme' => 'use_admin_theme'
));
}
/**
* @} End of "addtogroup updates-7.x-to-8.x"
* The next series of updates should start at 9000.
......
......@@ -223,7 +223,7 @@ function node_uri(EntityInterface $node) {
* Implements hook_admin_paths().
*/
function node_admin_paths() {
if (variable_get('node_admin_theme')) {
if (Drupal::config('node.settings')->get('use_admin_theme')) {
$paths = array(
'node/*/edit' => TRUE,
'node/*/delete' => TRUE,
......@@ -1900,10 +1900,10 @@ function node_form_system_site_information_settings_form_submit($form, &$form_st
* @see node_form_system_themes_admin_form_submit()
*/
function node_form_system_themes_admin_form_alter(&$form, &$form_state, $form_id) {
$form['admin_theme']['node_admin_theme'] = array(
$form['admin_theme']['use_admin_theme'] = array(
'#type' => 'checkbox',
'#title' => t('Use the administration theme when editing or creating content'),
'#default_value' => variable_get('node_admin_theme', '0'),
'#default_value' => Drupal::config('node.settings')->get('use_admin_theme'),
);
$form['#submit'][] = 'node_form_system_themes_admin_form_submit';
}
......@@ -1914,7 +1914,9 @@ function node_form_system_themes_admin_form_alter(&$form, &$form_state, $form_id
* @see node_form_system_themes_admin_form_alter()
*/
function node_form_system_themes_admin_form_submit($form, &$form_state) {
variable_set('node_admin_theme', $form_state['values']['node_admin_theme']);
Drupal::config('node.settings')
->set('use_admin_theme', $form_state['values']['use_admin_theme'])
->save();
}
/**
......
......@@ -35,7 +35,7 @@ public static function getInfo() {
function testNodeCreation() {
// Make sure the node creation page is considered an administrative path
// (which will appear in the overlay).
variable_set('node_admin_theme', TRUE);
$this->container->get('config.factory')->get('node.settings')->set('use_admin_theme', '1')->save();
// Create a content type and a user who has permission to create it inside
// the overlay.
......
......@@ -74,7 +74,7 @@ function testShortcutLinkAdd() {
function testShortcutQuickLink() {
theme_enable(array('seven'));
\Drupal::config('system.theme')->set('admin', 'seven')->save();
variable_set('node_admin_theme', TRUE);
$this->container->get('config.factory')->get('node.settings')->set('use_admin_theme', '1')->save();
$link = reset($this->set->links);
......
......@@ -183,7 +183,7 @@ function testAdministrationTheme() {
// Enable an administration theme and show it on the node admin pages.
$edit = array(
'admin_theme' => 'seven',
'node_admin_theme' => TRUE,
'use_admin_theme' => TRUE,
);
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
......@@ -201,7 +201,7 @@ function testAdministrationTheme() {
// Disable the admin theme on the node admin pages.
$edit = array(
'node_admin_theme' => FALSE,
'use_admin_theme' => FALSE,
);
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
......@@ -217,7 +217,7 @@ function testAdministrationTheme() {
->save();
$edit = array(
'admin_theme' => '0',
'node_admin_theme' => FALSE,
'use_admin_theme' => FALSE,
);
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
......
......@@ -98,7 +98,7 @@ function _translation_tab_access(NodeInterface $node) {
* Implements hook_admin_paths().
*/
function translation_admin_paths() {
if (variable_get('node_admin_theme')) {
if (Drupal::config('node.settings')->get('use_admin_theme')) {
$paths = array(
'node/*/translate' => TRUE,
);
......
......@@ -85,5 +85,5 @@ function standard_install() {
// Enable the admin theme.
theme_enable(array('seven'));
Drupal::config('system.theme')->set('admin', 'seven')->save();
variable_set('node_admin_theme', '1');
Drupal::config('node.settings')->set('use_admin_theme', '1')->save();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment