Problem/Motivation
In version 8.x-1.1 you could configure the module, per field on the manage form display, to "Select parents automatically" and when using the widget it would check the parent items all the way up a tree of nested terms when you checked a child term. While the setting remains on the manage form display screen, the functionality no longer appears to work. There is no JS console error in the browser when interacting with the widget. This functionality (and more) is also broken in the 8.x-1.2 release due to some JS errors that were committed in that release (javascript booleans `true` and `false` changed to uppercase).
Steps to reproduce
- Install version 2.0.0 of this module.
- Configure a term reference field on a node type with a vocabulary that has terms in a hierarchy to use this widget and check the "Select parents automatically" option on the manage form display screen.
- Visit the node add or edit screen for the node type configured above and try to check a child item in the tree of terms. Notice the parent terms aren't selected.
Proposed resolution
Identify the issue with changes to the module between 8.x-1.1 and 2.0.0 that caused this functionality to be lost and fix/restore it.
Remaining tasks
User interface changes
N/A
API changes
Data model changes
N/A
Issue fork term_reference_tree-3347244
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
jonraedeke CreditAttribution: jonraedeke commentedI created an MR that is ready for review.
Inside the
.forEach()
loop,this
is the global object (window). Also,true
andfalse
should not be capitalized.See docs.
Comment #5
timwoodMerge request provided and referenced by @jonraedeke in #4 above works to fix the issue for us.
Comment #6
KurtTrowbridgeReconfirming that this patch appears to fix both the "Select parents automatically" option mentioned here and the "Cascading selection" option, which also had settings in the form display widget that weren't taking effect in 1.2.0 or 2.0.0 like they did in 1.1.0. Thank you!
Comment #7
alexb7217I also just installed and tested the patch version and confirmed parent select and cascading select/deselect are working great.
$ git clone -b 3347244-select-parents-automatically https://git.drupalcode.org/issue/term_reference_tree-3347244.git
Then configured and tested as described in the documentation. ::thumbsup::
Comment #10
VladimirAusThanks everyone! 🍻
Committed!