--- taxonomynode.module 2009-09-20 00:19:27.000000000 +0200 +++ taxonomynodeNew.module 2009-10-10 15:05:11.000000000 +0200 @@ -132,11 +132,15 @@ function _taxonomynode_create_node($tid, } } // Re-add the parents as terms for this node - if (is_numeric($parents)) { - $parents = array($parents); - } - foreach ($parents as $pid) { - $node->taxonomy[] = $pid; + if ($taxonomynode_settings['node_term'] == 'term') { + $node->taxonomy[] = $tid; + } else { + if (is_numeric($parents)) { + $parents = array($parents); + } + foreach ($parents as $pid) { + $node->taxonomy[] = $pid; + } } node_save($node); @@ -207,6 +211,13 @@ function taxonomynode_form_alter(&$form, '#default_value' => $taxonomynode_settings['content_type'], '#description' => t('Choose the content type that will be created when adding new terms. Important note: If you change your content type selection once nodes have been created, you will have to manually remove the already created nodes for each of the terms of this vocabulary as well as unset the old content type from the Types associated to this vocabulary.') ); + $form['taxonomynode']['taxonomynode_node_term'] = array( + '#type' => 'select', + '#title' => t('Term to tag the created node with'), + '#options' => array('parent_term' => t('Parent term'), 'term' => t('Term')), + '#default_value' => isset($taxonomynode_settings['node_term']) ? $taxonomynode_settings['node_term'] : 'parent_term', + '#description' => t('Choose the term that the node should be tagged with. When choosing "Parent term", the node will be tagged with the parent of the term that the node refers to. Choosing "Term" will tag the node with the same term it relates to. Important note: changing this setting will not update the tags of existing nodes.') + ); $form['taxonomynode']['taxonomynode_batch'] = array( '#type' => 'checkbox', '#title' => t('Batch create'), @@ -321,6 +342,7 @@ function taxonomynode_taxonomy($op, $typ drupal_set_message(t('Taxonomy Node: You have changed your content type selection. If nodes have been created with the old content type, you will have to manually remove the already created nodes for each of the terms of this vocabulary as well as unset the old content type from the Types associated to this vocabulary.')); } $taxonomynode_settings['content_type'] = $content_type; + $taxonomynode_settings['node_term'] = $array['taxonomynode_node_term']; variable_set("taxonomynode_{$vid}", $taxonomynode_settings); // force vocabulary to have the assigned content as Type if ($content_type) {