Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hello,
I got the following issue when using i18n for taxonomy translation
Undefined property: stdClass::$vid dans i18n_taxonomy_term_name()
This appends on line 472 of i18n/i18n_taxonomy/i18n_taxonomy.module
I had to fix it with the code below
/**
* Get localized term name unfiltered.
*/
function i18n_taxonomy_term_name($term, $langcode = NULL) {
if ($term && isset($term->vid))
{
$key = i18n_object_info('taxonomy_term', 'key');
return i18n_taxonomy_vocabulary_mode($term->vid, I18N_MODE_LOCALIZE) ? i18n_string(array('taxonomy', 'term', $term->{$key}, 'name'), $term->name, array('langcode' => $langcode, 'sanitize' => FALSE)) : $term->name;
}
}
Comment | File | Size | Author |
---|---|---|---|
#9 | i18n_undefined-property-fix_2093043_4.patch | 1007 bytes | pascalim |
#4 | i18n_undefined-property-fix_2093043_3.patch | 987 bytes | pascalim |
#2 | i18n_undefined-property-fix_2093043_2.patch | 1.05 KB | reszli |
Comments
Comment #1
PasiC CreditAttribution: PasiC commentedHi tehem,
thank You for posting, You've saved my life - I had exactly the same issue. Default language English with one more enabled, Hungarian.
Except for my version of Taxonomy Translation is 7.x-1.9
Comment #2
reszlihere's a patch for the above, that fixed the notice for me
Comment #3
ah_ma81 CreditAttribution: ah_ma81 commentedHi @reszli .. i applied your patch and the patch in this issue https://www.drupal.org/node/1514794 and both removed the error ... thanks a lote.
but i have a big problem that any content type have Taxonomy Term Reference Tree Widget is very slow and it takes about 40 seconds to load the page.
Any help please will be appreciated.
Comment #4
pascalim CreditAttribution: pascalim commentedRe-rolled patch to apply cleanly on 7.x-1.x and replace
isset()
withproperty_exists
.Comment #5
pascalim CreditAttribution: pascalim commentedComment #6
harshil.maradiya CreditAttribution: harshil.maradiya commentedi have tested this patch its working as expected
Comment #9
pascalim CreditAttribution: pascalim commentedUpdated patch as we are missing trailing whitespace and this is causing tests to fail.
Comment #10
pascalim CreditAttribution: pascalim commentedComment #11
prashantgajare CreditAttribution: prashantgajare as a volunteer and commented@pascalim Thanks, for the re-rolled patch! Tested LGTM
Comment #12
Vj CreditAttribution: Vj as a volunteer commentedConfirmed #9 works, marking it as RTBC.