On one of my sites I have a content type with two taxonomy fields (X and Y), both using this vocabulary:
- A
- A1
- A2
- A3
- B
- B1
- B2
- B3
- C
- C1
- C2
- C3
For fild X a user may only pick level 1 terms like A, B or C.
Field Y should then be auto-completed with sub terms of the term chosen in field X.
So if field X contains term A, then field Y uses values A1, A2 and A3 for auto-completion.
So far so good. But now I want to allow my users to freetag their content and I would like to add the term to the term_data table.
With the current release this is impossible. My only options here are:
- Adding new terms as root level elements (Like A, B and C).
- Choosing a fixed term as their new parent.
But I would like this parent to be more flexible. So why don't we just add a PHP Field for the selection of the new parent just as we did with selecting the parent for auto-completion? I've included a patch to achieve exactly this. It needs some review and I hope it will be included in the content_taxonomy module.
| Comment | File | Size | Author |
|---|---|---|---|
| content_taxonomy_newparent.patch | 4.79 KB | xatoo_ |
Comments
Comment #1
xatoo_ commentedBy the way, this patch also fixes three warnings that the Coder module gave for not complying to the Drupal coding standard.
Comment #2
that0n3guy commentedDo you have an example of how to use this? I've been trying to use $_post (like shown here: http://drupal.org/node/460346) but it is not working?
Thanks
Comment #3
eL commentedYes please! How to use this? What code type in PHP Code for selecting the parent term?
Comment #4
eL commentedOh, here is it: http://drupal.org/node/460346
Comment #5
funky2D commentedHello there !
As i'm reading this i see that u've past the first step of auto-completion
I'm stack here ! I have the same vocabulary as u but i'm using select list!
What i'm trying to do is
1)For field X a user may only pick level 1 terms like A, B or C.
2)Field Y (which is a select list) should show only sub terms of the term chosen in field X.
Can you please post the example code to write in "advanced php code" of field Y, so i can return the ID of selected term in field X to only display childs term of selected term in field X.
I tried the code bellow but nothing happens !
I posted my question here: http://drupal.org/node/925696 before i read your post !
thanks in advance for your help!
funky2D
Comment #6
funky2D commentedAnyone to help on this ????