Provide tree widget for term reference fields

Created on 28 July 2011, about 14 years ago
Updated 27 June 2025, about 2 months ago

Since this module provides a form element, it seems like the next logical step should be to allow this element to be used as a widget with taxonomy term reference fields in Field API. I wrote code that can make this happen, but it's actually dependent on two other patches I just wrote to fix related issues:

There's a problem with the way the taxonomy manager tree element keeps track of its form parents in Javascript. I submitted a patch to fix this problem here: http://drupal.org/node/1222214. Without applying this patch, the form widget won't work anytime it's nested in form elements whose names contain hyphens or underscores (when you click the + to expand a term and then pick child terms, those child terms won't appear as selected in $form_state). This is a problem for Field API, because most field names have underscores in them.

There is also a problem with terms being selected when you use the form element to select single values (when it's rendered as radio buttons instead of checkboxes). This patch here allows the form element to be used with either single or unlimited-value fields, so this needs to work properly. I submitted a patch at http://drupal.org/node/1232516 to allow the radio buttons to work.

This patch alone should give you the basic Field API functionality (right now, the widget is only allowed to work with taxonomy term reference fields, with 1 value or unlimited values), but without the other two patches, you won't be able to select expanded child terms or use single-value fields.

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States nkschaefer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024