If you want to move a term between vocabularies, which I often do, you either have to update it directly in the database or download http://drupal.org/project/taxonomy_switch - which doesn't have a D6 version and has a very strange interface. It's possible taxonomy manager does this, but last time I tried it didn't.

$vid is already in the term edit form, so all we need to do is make it into a select instead of #value.

Comments

catch’s picture

StatusFileSize
new10.04 KB

Grr, I'd removed the useless description from the patch before posting, but not from the screenshot.

catch’s picture

StatusFileSize
new2.95 KB

Added a test.

pp’s picture

Status: Needs review » Needs work
StatusFileSize
new24.18 KB

First problem:
You always set $vocabulary the last one in the $vocabularyes. Use different variable name in the foreach!


  foreach ($vocabularies as $vocabulary) {
    $options[$vocabulary->vid] = $vocabulary->name;
  }
...
    '#default_value' => $vocabulary->vid,

Second:
What about the other selects(Related terms, Parents) int the Advenced options?
I created another vocabulary. Its name is Tags2. Created two tags (tags2_term1, tags2_term2) and edited tags2_term2. I think If I set tags2_term1 for parent and Tags for vocabulary the database will be inconsistent.

pp

catch’s picture

Status: Needs work » Needs review
StatusFileSize
new3.72 KB

Cross-posted - I'd fixed the variable naming already.

Related terms and parents, hmm, yes that's an issue. There's nothing in the schema to stop you from setting these across vocabularies (I can see use cases for this for related terms, not for parents though), but core doesn't support it.

Added validation to prevent moving a term between vocabularies if it has parents, children or related terms.

Status: Needs review » Needs work

The last submitted patch failed testing.

xano’s picture

Brain fart: what about related terms in different vocabularies?

catch’s picture

Status: Needs work » Needs review
StatusFileSize
new2.89 KB

Straight re-roll for the bot.

Anonymous’s picture

Status: Needs review » Closed (won't fix)

This is an edge case with only hacky contrib solutions that only developers should use and only with fair warning. When vocabularies can have different fields, it's not reasonable to do this in core. Too much would easily break.

We can only treat this as "normal" as changing a node from one type to another would be.

See http://drupal.org/project/nodetype