I need a little help here. I am creating a sub theme of bootstrap theme and I need to add an additional fieldset under "Bootstrap Settings" form (similar to Components, Advanced etc which are currently present) which appears under Appearance->Settings-><THEME NAME> page. I think we can use hook_form_alter() for this but the problem is that hook_form_alter() is being always invoked with $form_id set to "search_form" and never "system_theme_settings". Thus any form updates I am making under this hook are getting applied to search box instead of admin settings form.

I referred code under bootstrap_form_alter() in alter.inc file in bootstrap theme and tried to replicate it in sub theme but it doesn't seem to work. In order to ensure that I am not making any mistakes while creating subtheme I also tried using other available subtheme such as one created by Adam Balsam (he has provided details on this in response to a question here.

Any help/pointers would be greatly appreciated.

I am listing below my code from template.php file of the bootstrap_ignitor sub theme

function bootstrap_ignitor_form_alter(&$form, &$form_state, $form_id) {
  drupal_set_message('<pre>'.print_r($form_id,TRUE).'</pre>'); ***<= this always prints as search_block_form***
  $form['actions']['submit']['#attributes']['class'][] = 'btn';
  _bootstrap_ignitor_settings_form($form, $form_state);

function _bootstrap_ignitor_settings_form(&$form, $form_state) {

  // Advanced settings.
  $form['themealter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Theme Alter'),
    '#group' => 'bootstrap',

  $form['themealter']['local_cdn'] = array(
    '#type' => 'fieldset',
    '#title' => t('NewBootstrapCDN'),
    '#description' => t('Testing...'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,


1 Answer 1


You need to create theme-settings.php in your theme directory & add following function in that to add new fields as shown in code below:

function <THEME_NAME>_form_system_theme_settings_alter(&$form, &$form_state) {
    $form['campaign_pages'] = array(
        '#title' => t('Campaign Pages'),
        '#type' => 'textarea',
        '#description' => t('Specify pages by using their paths. Enter one path per line.'),
        '#default_value' => theme_get_setting('campaign_pages'),


Here theme_get_setting stores the value of your field.

  • Thanks @Vishal this worked. One quick question. Can you help me understand why hook_form_alter() can not be used for changing admin settings form? The reason I am asking this is because the bootstrap base theme build the admin settings form under bootstrap_form_alter() in alter.inc
    – MAJ
    Commented Mar 4, 2015 at 16:40
  • hook_form_alter() is used to alter forms used in theme e.g. search, contact, webform etc. Commented Mar 5, 2015 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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