It is straightforward to create a dependency on an explicit taxonomy term, but let's say I have a nested taxonomy like:

Term Parent
- Term Child 1
- Term Child 2
- Term Child 3
...
- Term Child 15

I would like to show a field if any of the terms within the term parent are selected. What would be the easiest way to do that in this module?

I can use the term id values in a list, but would be nice to be able to just base the value off the parent, so that terms that are created under in in the future can continue to display the dependent fields.

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

Sansui created an issue. See original summary.

t0xicCode’s picture

Status: Active » Needs review
FileSize
7.19 KB

This patch seems to make it work with taxonomy referenced through an entity_reference field. Adding support for the taxonomy_reference field should be fairly straight forward.

t0xicCode’s picture

FileSize
7.22 KB

Updated the patch to better deal with grandchildren and descendants further down. Also updated the UI to reflect that we now deal with descendants, not just children.

t0xicCode’s picture

Category: Support request » Feature request
delacosta456’s picture

hi @Sansui
the patch #3 doesn't apply corrctly

delacosta456’s picture

hi @Sansui
I am sorry never mind... it was a file/folder permission blocking the patch not apply

Ghost of Drupal Past’s picture

This is an issue with Drupal 9 as well as far as I can tell.

sarathkm’s picture

Version: 7.x-3.x-dev » 4.x-dev
Status: Needs review » Needs work
sarathkm’s picture

Assigned: Unassigned » sarathkm

sarathkm’s picture

This feature has been tested and developed while using cshs module. Need to enable a checkbox in conditional field configuration as needed.

sarathkm’s picture

Assigned: sarathkm » Unassigned
Liam Morland’s picture

Liam Morland’s picture

I tried the patch in #11. It did not work for me. Based on that I created this version that works for me.

I have updated the merge request with these changes.

Liam Morland’s picture

Title: Creating dependency on taxonomy parent term? » Allow creating dependency on parent taxonomy term
Liam Morland’s picture

This patch moves the code to ConditionalFieldsFormHelper, allowing it to work on all handler types. Previously, it only worked on the default handler. I have updated the merge request with these changes.

I have also rebased the merge request.

This patch applies to 4.0.0-alpha5.

Liam Morland’s picture

This patch is from the rebased merge request and applies to 4.x.

dqd’s picture

Status: Needs review » Needs work

Last patch looks good. +1 Better than before because it does not remove/replace anything existing in code and sits on the right spot now. Thanks for all the efforts and work in here. +1

We need user tests on latest dev and foremost we need test coverage for this newly implemented feature. Gitlab testing CI for Conditional fields (issue) is on the way, but not ready yet.

And, I would love to see confirmation of multiple users testing it in the wild, and that it does not break other features of this project.