- Issue created by @bogdan.dinu
- π·π΄Romania bogdan.dinu
Previous patch added third level items as top level items. I created a new patch to fix it.
- Status changed to Needs review
6 months ago 3:04pm 14 May 2024
When using the '#allowed' key to limit the terms in the tree, if the allowed items are not on first level, then the resulting tree is empty.
Add a vocabulary with 1 top level term and a child term.
Add a field that references the vocabulary and set Term Reference Tree as the form widget for the field.
From code, use the form alter hook to add the child term to the '#allowed' list for the field.
Expected result: Only the child term is displayed.
Actual result: Term tree is empty.
The method _term_reference_tree_get_term_hierarchy only checked the allowed list against top level terms. I added an else clause where it looks for the allowed term id in the top level terms to manually load the term if it is doing the initial load of terms.
Needs review
2.0
Code
Previous patch added third level items as top level items. I created a new patch to fix it.