? tss_drupal6.patch Index: taxonomy_super_select.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_super_select/Attic/taxonomy_super_select.info,v retrieving revision 1.1 diff -u -p -r1.1 taxonomy_super_select.info --- taxonomy_super_select.info 7 Feb 2007 22:11:05 -0000 1.1 +++ taxonomy_super_select.info 27 Oct 2008 12:44:18 -0000 @@ -1,4 +1,6 @@ ; $Id: taxonomy_super_select.info,v 1.1 2007/02/07 22:11:05 codexmas Exp $ name = Taxonomy Super Select description = Changes the default taxonomy select box into checkbox or radio buttons -dependencies = taxonomy \ No newline at end of file +dependencies[] = taxonomy +core = 6.x + Index: taxonomy_super_select.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_super_select/taxonomy_super_select.module,v retrieving revision 1.2.2.1 diff -u -p -r1.2.2.1 taxonomy_super_select.module --- taxonomy_super_select.module 30 Sep 2008 04:17:51 -0000 1.2.2.1 +++ taxonomy_super_select.module 27 Oct 2008 12:44:18 -0000 @@ -6,27 +6,25 @@ * Changes the default taxonomy select box into checkbox or radio buttons. */ -function taxonomy_super_select_form_alter($form_id, &$form) { +function taxonomy_super_select_form_alter(&$form, $form_state, $form_id) { drupal_add_css(drupal_get_path('module', 'taxonomy_super_select') .'/taxonomy_super_select.css'); // Taxonomy Edit Form if ($form_id == 'taxonomy_form_vocabulary') { - $vid = $form['#parameters'][1]['vid']; - $vocab = taxonomy_get_vocabulary($vid); + $vid = $form['vid']['#value']; + $vocab = taxonomy_vocabulary_load($vid); if ($vocab) { $tss = variable_get('taxonomy_super_select_vid_'. $vid, 0); // Position the name field higher - $form['name']['#weight'] = -2; // Add our own submit handler - $form['#submit']['taxonomy_super_select_submit'] = array(); + $form['#submit'][] = 'taxonomy_super_select_submit'; // Create fieldset and form elements - $form['tss'] = array( + $form['settings']['tss'] = array( '#type' => 'fieldset', '#title' => t('Taxonomy Super Select'), - '#value' => $info, '#collapsible' => TRUE, - '#collapsed' => $tss ? FALSE : TRUE, + '#collapsed' => ($tss ? FALSE : TRUE), '#tree' => TRUE, - '#weight' => 0, + '#weight' => 3, ); // Get list of all content types $types = node_get_types('names'); @@ -34,27 +32,28 @@ function taxonomy_super_select_form_alte foreach ($vocab->nodes as $index => $type) { $options[$type] = $types[$type]; } - $form['tss']['taxonomy_super_select_vid_'. $vid]['types'] = array( + $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['types'] = array( '#type' => 'checkboxes', '#title' => t('Enable Taxonomy Select for the Vocabulary Content Types Below'), - '#options' => $options, - '#default_value' => $tss['types'], + '#options' => $options, + '#default_value' => ($tss ? $tss['types'] : array()), '#weight' => -1, ); - $form['tss']['taxonomy_super_select_vid_'. $vid]['parents'] = array( + $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['parents'] = array( '#type' => 'checkbox', '#title' => t('Display parent terms as form items'), - '#default_value' => $tss['parents'], + '#default_value' => ($tss ? $tss['parents'] : array()), '#return_value' => 1, '#weight' => 0, - '#description' => t('Leaving this disabled forces users to select dangling child terms. Useful for grouping terms with descriptive parent terms that are not themselves needed for display.'), + '#description' => t('Leaving this disabled forces users to select dangling child terms. Useful for grouping terms with descriptive parent terms that are not themselves needed for display.'), ); if (module_exists('taxonomy_image')) { - $form['tss']['taxonomy_super_select_vid_'. $vid]['image'] = array( + $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['image'] = array( '#type' => 'checkbox', '#title' => t('Allow Taxonomy Image to provide images with the terms'), - '#default_value' => $tss['image'], + '#default_value' => ($tss ? $tss['image'] : array()), + '#weight' => 2, ); } } @@ -103,6 +102,7 @@ function taxonomy_super_select_form_alte } } } + /** * Recursive function to allow infinite depth vocabularies. * @@ -148,6 +148,7 @@ function _tss_branch($vid, $term, $value case 'fieldset': // In this section, $term is actually the vocabulary. // Automatically expand required vocabs or if the parent term is selected + $collapsed = ($required OR $term->parent_value) ? FALSE : TRUE; if ($term->help) { $help = '
'. $term->help .'
'; @@ -215,7 +216,7 @@ function taxonomy_super_select_nodeapi(& $tss = variable_get('taxonomy_super_select_vid_'. $vid, FALSE); // Validation required if ($tss['types'][$node->type]) { - $vocabulary = taxonomy_get_vocabulary($vid); + $vocabulary = taxonomy_vocabulary_load($vid); $single = TRUE; $has_term = FALSE; // Check for freetagging items in the form @@ -283,7 +284,7 @@ function taxonomy_super_select_nodeapi(& } } } - } + } } // Catch freetagging vocabs that are single select with a radio checked as well as a new tag if (!$single AND !$vocabulary->multiple) { @@ -308,13 +309,17 @@ function taxonomy_super_select_nodeapi(& } } -function taxonomy_super_select_submit($form_id, $form_values) { - if ($vid = $form_values['vid'] AND $form_id == 'taxonomy_form_vocabulary') { - if (count($form_values['tss']['taxonomy_super_select_vid_'. $vid])) { - variable_set('taxonomy_super_select_vid_'. $form_values['vid'], $form_values['tss']['taxonomy_super_select_vid_'. $vid]); - } - else{ - variable_del('taxonomy_super_select_vid_'. $form_values['vid']); - } +function taxonomy_super_select_submit(&$form, $form_state) { + $vid = $form['vid']['#value']; + if (count($form['settings']['tss']['taxonomy_super_select_vid_'. $vid])) { + $tostore = array( + 'types' => $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['types']['#value'], + 'parents' => $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['parents']['#value'], + 'image' => $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['image']['#value'], + ); + variable_set('taxonomy_super_select_vid_'. $vid, $tostore); + } + else{ + variable_del('taxonomy_super_select_vid_'. $vid); } -} \ No newline at end of file +}