With the latest version of Hierarchical Select I'm getting the following notices and warnings when I try to edit a taxonomy term that has <root> as its parent:

Notice: Undefined property: stdClass::$vid in i18n_taxonomy_term_name() (regel 448 van /sites/all/modules/contrib/i18n/i18n_taxonomy/i18n_taxonomy.module).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (regel 178 van /includes/entity.inc).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (regel 354 van /includes/entity.inc).
Notice: Trying to get property of non-object in i18n_taxonomy_vocabulary_mode() (regel 1022 van /sites/all/modules/contrib/i18n/i18n_taxonomy/i18n_taxonomy.module).
Notice: Undefined property: stdClass::$vid in i18n_taxonomy_term_name() (regel 448 van /sites/all/modules/contrib/i18n/i18n_taxonomy/i18n_taxonomy.module).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (regel 178 van /includes/entity.inc).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (regel 354 van /includes/entity.inc).
Notice: Trying to get property of non-object in i18n_taxonomy_vocabulary_mode() (regel 1022 van /sites/all/modules/contrib/i18n/i18n_taxonomy/i18n_taxonomy.module).

This problem has been introduced in commit e8241a784fe (ref. #1216214: D7 i18n Taxonomy compatibility):

@@ -765,7 +765,7 @@ function _hs_taxonomy_hierarchical_select_terms_to_options($terms) {
   $options = array();
   foreach ($terms as $key => $term) {
     // Use the translated term when available!
-    if (module_exists('i18ntaxonomy') && isset($term->vid) && i18ntaxonomy_vocabulary($term->vid) == I18N_TAXONOMY_LOCALIZE) {
+    if (module_exists('i18n_taxonomy')) {
       $options[$term->tid] = tt("taxonomy:term:$term->tid:name", $term->name);
     }
     else {

The check isset($term->vid) has been removed in this commit, but this was apparently there for a good reason: if a term's parent is <root> this passes on a term object that is not fully populated: it has a tid set to '0', and lacks most parameters, including the vid on which i18n_taxonomy relies.

Comments

pfrenssen’s picture

Status: Active » Needs review
StatusFileSize
new1004 bytes
renat’s picture

Patch from #1 completely solved this problem for me. Thank you, pfrenssen.

wim leers’s picture

Status: Needs review » Fixed

Thanks for the patch, pfrenssen! Committed your patch: http://drupalcode.org/project/hierarchical_select.git/commit/d86f21a.

Status: Fixed » Closed (fixed)

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

Joel MMCC’s picture

Title: Warnings and notices when editing a taxonomy term that has <root> as its parent » Warnings and notices when editing a taxonomy term that has &lt;root&gt; as its parent

Attempting to rename the Title of this Issue to remove the pseudo-HTML “root” tag, so that the title properly displays in Issue List, etc.

Joel MMCC’s picture

Title: Warnings and notices when editing a taxonomy term that has &lt;root&gt; as its parent » Warnings and notices when editing a taxonomy term that has ‹root› as its parent

Trying again, this time using Left & Right Single Angle Quotes instead of actual less-than or greater-than signs, nor their HTML Named Entity equivalents. This should get the point across without corrupting the display.