Hello,
Is there a module or some code I can use to take a user's node title entry for a specific node type, and populate a taxonomy field with a comma-separated list of the words entered in the title field? This taxonomy field is hidden from the user, if that matters.

node/add/blahtype
Title: this is wrb123 article about cats and dogs
Taxonomy: blank (hidden)

results in:
Title: this is wrb123 article about cats and dogs
Taxonomy: this, is, wrb123, article, about, cats, and, dogs

It would additionally be helpful to remove any duplicate words in the title, only including them once in the comma-separated list in the taxonomy, and also to maybe not include any word from a list of words i specify such as "this" "is" "and" etc.

Thanks!

Comments

msielski’s picture

This was discussed in #drupal-support on Dec 11, 2009 and we came up with this solution. It's probably not perfect, but it may work:

make a custom module that uses hook_nodeapi to adjust taxonomy terms when node is saved:

function mymodulename_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {

  $vid = 2;  // this is the vocab id of the free-tagging-enabled vocabulary you want to tag to

  // mynodetype below is the system name of the content type you want this to work with

  if (($node->type == 'mynodetype') && ($op == 'prepare')) {
    $node->taxonomy['tags'][$vid] = preg_replace('/ /', ',', $node->title);
  }

}
moserwi’s picture

It seems that the module NAT Node Auto Term http://drupal.org/project/nat is the solution for this problem.

modules to consider: taxonomy, lexicon or (maybe glossary) and nat