I am creating an installation profile, and I can succesfully download and enable my custom theme as default. The issue I am running into is the "Use the administration theme when editing or creating content" setting is disabled on a fresh install, and I always want that enabled.

  1. How do I enable the "Use the administration theme when editing or creating content" setting in my install profile?
  2. What is the easiest way to find out how to configure settings like this in the future? The install profile documentation does not give any info on this, and I can't find anything in the API.

Update: I've found this API article api document to be helpful in figuring out which fields to target.

2 Answers 2


Setting it is as simple as:

variable_set('node_admin_theme', 1);

Most (not all, but most) config settings used in Drupal are managed using a system_settings_form(), which basically takes the array keys of the elements used in that form, and saves them as variables.

So an abridged version of the theme settings form would be

function some_form($form, &$form_state) {
  $form['node_admin_theme'] = array(
    '#title' => t('Use the administration theme when editing or creating content'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('node_admin_theme', 0),

  return system_settings_form($form);

When Drupal processes that form, a variable called node_admin_theme is created/updated with the appropriate value.

If you're certain a form is using system_settings_form(), finding the names of the associated variables is as easy as inspecting the elements themselves and looking at the 'name' parameter, e.g.

enter image description here

If you're not sure, lookup the function that defines the form and check. If it does use system_settings_form() then great, and if not you get an insight into how that form actually manages its data.


I spent sometime on your question 1. and i found this solution : Create a file named : "node.settings.yml" and put it in your config>install folder of your profile. Just write this in the file :

use_admin_theme: true

Edit: this solution is for drupal 8.

  • Nice findings! Although OP maybe probably meant to do this in Drupal 6 (taking the post date into account). Maybe you can add a line that your answer is for Drupal 8.
    – leymannx
    Jan 31, 2019 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.