On the Taxonomy Theme settings page, under the first tab "Global"

I have the "Show theme option in create/edit node forms" checked. Below it, is a collapsible section "Show 'Theme' option for nodes of type" with a table listing of all the node types with a checkbox for each type. This section allows selecting/deselecting which node types should have the theme selector. Upon submission, only the checked node types get saved in the variables table along with the value of 1. Node types not checked are NOT saved with the value of 0. The default value of the variable is 1. So the problem is that all node types have a value of 1.

There are a couple of solutions.
1. Change the default value to 0
2. Change the input type on the settings form to a select menu or radio buttons
3. Something else ???

I think changing the default to 0 is worthy of debate, so I leave that idea for another time and place.

Below is a section of code from the module that highlights a small code update that would change the input type from checkbox to select menu. This code is found in the taxonomy_theme_admin.inc file in the taxonomy_theme_admin_form function.

if ($extended_enabled && variable_get('taxonomy_theme_alter_node', 0)) {
  $nodetypes = node_get_types('names');
  if (count($nodetypes)) {
    $form['global']['alter_node_nodetypes'] = array(
      '#type' => 'fieldset',
      '#title' => t('Show \'Theme\' option for nodes of type'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $rows = array();
    $header = array(t('NodeType'), t('Enabled'));
    $form['global']['alter_node_nodetypes']['table'] = array('#theme' => 'taxonomy_theme_table');
    $form['global']['alter_node_nodetypes']['table']['header'] = array('#data' => $header);
    $form['global']['alter_node_nodetypes']['table']['type'] = array('#value' => 'taxonomy_theme_alter_nodetype|');
    foreach ($nodetypes as $type => $title) {
      $form['global']['alter_node_nodetypes']['table'][$type]['title'] = array('#value' => $title);
      //-----------------------------------------------------
      // CURRENT CODE
      //-----------------------------------------------------
      $form['global']['alter_node_nodetypes']['table'][$type]['taxonomy_theme_alter_nodetype|'.$type] = array(
        '#type' => 'checkbox',
        '#default_value' => variable_get('taxonomy_theme_alter_nodetype|'.$type, 1),
      );
      //------------------------------------------------------
      // SUGGESTED CHANGE
      //------------------------------------------------------
      $form['global']['alter_node_nodetypes']['table'][$type]['taxonomy_theme_alter_nodetype|'.$type] = array(
        '#type' => 'select',
        '#default_value' => variable_get('taxonomy_theme_alter_nodetype|'.$type, 1),
        '#options' => array(1 => t('Yes'), 0 => t('No')),
      );
      //------------------------------------------------------
      // END
      //------------------------------------------------------
    }
  }
}

Comments

profix898’s picture

Status: Active » Fixed

Committed to Drupal-5 branch. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)