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

  1. Install version 2.0.0 of this module.
  2. 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.
  3. 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

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

timwood created an issue. See original summary.

jonraedeke made their first commit to this issue’s fork.

jonraedeke’s picture

Status: Active » Needs review

I created an MR that is ready for review.

Inside the .forEach() loop, this is the global object (window). Also, true and false should not be capitalized.

See docs.

timwood’s picture

Status: Needs review » Reviewed & tested by the community

Merge request provided and referenced by @jonraedeke in #4 above works to fix the issue for us.

KurtTrowbridge’s picture

Reconfirming 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!

alexb7217’s picture

I 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::

VladimirAus made their first commit to this issue’s fork.

VladimirAus’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone! 🍻
Committed!

Status: Fixed » Closed (fixed)

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