Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps to reproduce:
1) add vocabulary at admin/structure/taxonomy/add named Tags
2) navigate admin/structure/taxonomy/tags and click "Add term" - admin/structure/taxonomy/tags/add
3) click "List" to return back to admin/structure/taxonomy/tags
There's no term in list!
This caused by using taxonomy_get_tree() in taxonomy_overview_terms()
Newly created term have no records in {taxonomy_term_hierarchy}
Comment | File | Size | Author |
---|---|---|---|
#2 | 762604_term_edit-d7.patch | 2.01 KB | andypost |
#1 | 762604_term_edit-d7.patch | 753 bytes | andypost |
Comments
Comment #1
andypostWhen term is edit default parent is not set
Simple fix
Comment #2
andypostNow with test
Comment #3
yched CreditAttribution: yched commentedBumped into that as well. Raising to critical.
I'll let catch or bangpound review the fix, though.
Comment #4
catchI really dislike that we use taxonomy_get_tree() in taxonomy_overview_terms() but that's not for this issue to fix. Patch itself looks good.
Comment #5
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #6
andypostAbout #4 I file new issue #763380: Do not use \Drupal\taxonomy\TermStorageInterface::loadTree() in \Drupal\taxonomy\Form\OverviewTerms::buildForm()
Comment #7
mikeryanHold on a sec... taxonomy_get_tree() does an inner join to taxonomy_term_hierarchy, so it appears that every term is expected to have a row in taxonomy_term_hierarchy, correct? So, shouldn't taxonomy_term_save enforce this? I'll see if I can throw together a patch...
Comment #8
andypost@mikeryan and already commited patch makes adding this row for every term
Comment #9
mikeryanIf you mean the patch you submitted in comment #2, that only fixes it for terms created through the UI - my point is that programmatic creation does not benefit from this patch, it needs to be in taxonomy_term_save().
Comment #10
andypost@mikeryan if you saving terms from custom module you should care about setting $term->parent because only developer knows about own data format.