Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I use the "" option, a new item is duly created - but the select list reverts to "". Wouldn't it make more sense for the new item to be selected by default?
Comments
Comment #1
Wim LeersIt should be, but it indeed isn't. It was, in D6 and D5. Something must've gone wrong with the port to D7.
Comment #2
Wim LeersAny people experiencing this issue, please contribute by debugging this. Starting point:
_hierarchical_select_process_calculate_selections()
, specifically at:It seems
$value
doesn't get set, and hence the following can't work either:Comment #3
lpedretti CreditAttribution: lpedretti commentedThe hook in hs_taxonomy.module, line 639
As the term is an object, it's passed by reference to taxonomy_term_save(), and in the inline documentation of taxonomy_term_save in drupal's taxonomy.module:
so, replacing foreach ($children as $term) {...} with just return $term->tid; should be enough.
It fixed the issue for me.
Hope it helps!
Best regards
Comment #4
NWOM CreditAttribution: NWOM commentedI was having the same issue and the solution works great. In the current dev release, the code mentioned above, starts at line #771.
Would love to see this patched. Thanks.
Comment #5
stefan.r CreditAttribution: stefan.r commentedCommitted to 7.x-dev
(see commit f196e92)