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.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1266542-1-hierarchical_select-warnings_taxonomy.patch | 1004 bytes | pfrenssen |
Comments
Comment #1
pfrenssenComment #2
renat commentedPatch from #1 completely solved this problem for me. Thank you, pfrenssen.
Comment #3
wim leersThanks for the patch, pfrenssen! Committed your patch: http://drupalcode.org/project/hierarchical_select.git/commit/d86f21a.
Comment #5
Joel MMCC commentedAttempting to rename the Title of this Issue to remove the pseudo-HTML “root” tag, so that the title properly displays in Issue List, etc.
Comment #6
Joel MMCC commentedTrying 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.