Vocabulary edit form resets the 'hierarchy' field to '0' and 'relations' field to '1'
David Lesieur - January 3, 2009 - 06:41
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | taxonomy.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
The vocabulary edit form hardcodes the value of the 'hierarchy' flag to '0', therefore resetting it when the form is submitted and the vocabulary saved.
This flag is normally assigned though taxonomy_check_vocabulary_hierarchy() which is called when terms are modified.
I think it should be '0' when first creating a vocabulary, but preserved whenever an existing vocabulary is edited—which is what this tiny patch does.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| taxonomy-hierarchy.patch | 932 bytes | Idle | Failed: Failed to apply patch. | View details | Re-test |

#1
I'm surprised that no one seems to have stumbled onto this bug.
The patch still applies...
#2
Yep, I had noticed this before but thought nothing of it, until I installed Faceted Search and ran into the bug. Patch applies and solves the issue. Thanks David!
#3
I confirm that the patch works. Also ran into it using faceted search.
#4
To others who might wonder: This is really a (trivial) bug in Drupal core. Faceted Search only springs up because only a few modules rely on this flag.
#5
Re-rolled patch for D7.
#6
Neat, but could we fix the similarly hard-coded value of $form['relations'] just below it as well?
There's another slight WTF there: The defaults added to the $edit array at the top of the function make $edit['relations'] default to 0 - but the hard-coded form value forces it to 1. If we continue to enable relations by default, then this value should be changed in the defaults array.
#7
Implemented the suggested fixes.
#8
Looks good now.
#9
Can we write a test for this please, or adjust the existing tests? Thanks!
#10
Are there any plans to release this patch in the next 6.x version of Drupal? I too am using the faceted search module and found this issue via #420354: Subcategories / Terms not heirachical in Guided Search
#11
yes, please... include it also in D6...
It's really a big issue to have to go back to database each time someone updates the hierarchy parameters...