keep term details in elements array for 3rd party modifications

Created on 9 March 2023, almost 2 years ago

Problem/Motivation

Taxonomy terms are fieldable. That means that they could consist of way more information than name and tid.

Using hook_query_term_reference_tree_get_children_alter() you can easily add these fields and their values to the term objects that are used to build the tree.

It would be nice to still have access to these fields in hook_preprocess_checkbox_tree_item() and the corresponding template!

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇩🇪Germany mkalkbrenner 🇩🇪

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

Comments & Activities

  • Issue created by @mkalkbrenner
  • Status changed to Needs review almost 2 years ago
  • 🇩🇪Germany mkalkbrenner 🇩🇪
    +++ b/term_reference_tree.module
    @@ -414,13 +419,11 @@ function _term_reference_tree_build_item($element, $term, $form_state, $value, $
    -    if (is_array($e)) {
    

    This check is not needed because $e is initialized as array directly above:

    $e = [ ... ];
    

    That's why I removed the not required if statement here, just because I recognized it.

Production build 0.71.5 2024