Suppose I have a vocabulary with this structure:

Term 1
--Term 1a
--Term 1b
Term 2
--Term 2a
--Term 2b

On my node add/edit form, how can I configure my content taxonomy field to allow any term within the Term 1 group, including Term 1 itself (the parent term) to be selectable? In other words, the select box would have these options:

Term 1 (this would be the default. If the user thinks that neither 1a nor 1b apply, the content would simply be tagged with term 1)
--Term 1a
--Term 1b

CommentFileSizeAuthor
#8 content_taxonomy.include_parent.patch2.34 KBjcarnett

Comments

mh86’s picture

Status: Active » Fixed

parent terms are by default selectable (e.g. in any select box, checkboxes, radios).
additionally you can define the default value (here Term 1) in your field settings

Chris Einkauf’s picture

Thanks for your reply mh86 (to this and to my other issue that you answered). Perhaps I am just missing something obvious, but I still can't get this to work. I'll use a different example to demonstrate what I want to do...

Let's assume my "animals" vocabulary looks like this:

Dog
--Big Dog
----Great Dane
----St. Bernard
--Small Dog
----Bichon Frise
----Toy Charles
Cat
--Big Cat
----Tiger
----Lion
--Small Cat
----Tabby Cat
----Persian

Now let's say I have a "Big Cat" content type, and in that content type's content taxonomy field, I want to ask the user what kind of big cat it is. I want these to be the options:

Big Cat (select this to just tag it as a big cat in general, i.e. if it's not a tiger or lion)
--Tiger
--Lion

When I set "Big Cat" as the parent term, the select box looks like this:

-None-
Tiger
Lion

So, there's no "Big Cat" option. If I instead set "Cat" as the parent term, the user gets the additional "Small Cat"-related options. How, then, would I go about just presenting Big Cat, Tiger, and Lion as options?

mh86’s picture

now I understand the problem

At the moment there is no option to include the actual parent term in the select list. To solve this, you would need another parent term above the "Big Cat" term (your taxonomy maybe will look strange afterwards). Or you going to write a patch to support the optional listing of the parent term :-)

Chris Einkauf’s picture

Thanks again for the reply, mh86. It definitely saved me from wasting some time playing around with the content taxonomy UI to try to get this to work.

I've never written a patch before, but I certainly wouldn't be opposed if I can actually come up with the solution to this. What program should I use to write a patch? Also, are there any good reading materials you'd recommend for getting me started with writing patches? I suppose I should also learn some of the basics of module building, but I've been wanting to learn that stuff anyway so this might be a good opportunity. (No promises about actually coming up with a working patch, though - I'm pretty noobish)

jameshenry’s picture

One thing, that you could do, is autotagging the node "big cat" with the term "big cat". In addition to that you give the user the possibility to add the tags "Tiger" or "Lion" if they like.

In that case, every "big cat" node will be tagged with "big cat" and some will be tagged with "big cat" and "tiger" or "lion"

Autotagging can be done with the modul "taxonomy defaults"
http://drupal.org/project/taxonomy_defaults

(but be careful, this modul is not suppporting content taxonomy, that means you cannot use it to autofill a cck field of the type "content taxonomy", but you can use it to tag the node with the term related to the content taxonomy field)

Chris Einkauf’s picture

Thanks Ned Needle. I'll check that out.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jcarnett’s picture

Version: 6.x-1.0-rc1 » 6.x-1.0-rc2
Status: Closed (fixed) » Needs review
StatusFileSize
new2.34 KB

Here's a patch to add an "Include parent term" option on the field settings. Checking it adds the parent term to the exposed options in the form. I've only tested with the checkbox/radio and select widgets and it works for me so far.

tribe_of_dan’s picture

I tried this patch but I see no difference. I still can't select the parent term and parent term doesn't seem to be saved.

WilliamB’s picture

I was looking to do the same thing and customize the module.
I'm on Drupal 7 though.
But in the content_taxonomy.module file i only see the function that add the "parent" field.
Where and how are the taxonomy children selectioned in the code? I can't find it.

WilliamB’s picture

Anyone can help for Drupal 7?

tribe_of_dan’s picture

Status: Needs review » Needs work

Would anybody be willing to make a patch so this works with Hierarchical Select?