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 using ->set('something') with field translation enabled on this field, it gives me a warning :
Warning: Illegal string offset 'translatable' in field_is_translatable() (line 180 of /very_cool_project/modules/field/field.multilingual.inc).
After adding some backtrace, found out entity_metadata_field_verbatim_set calls entity_metadata_field_get_language with the wrong arguments:
$langcode = entity_metadata_field_get_language($entity_type, $entity, $entity_type, $langcode);
instead of
$langcode = entity_metadata_field_get_language($entity_type, $entity, $field, $langcode);
I'll attach a patch in the first comment, don't know what the issue ID will be...
Comment | File | Size | Author |
---|---|---|---|
#1 | entity-fix_arguments-1829156-1.patch | 744 bytes | Pierre Paul Lefebvre |
Comments
Comment #1
Pierre Paul Lefebvre CreditAttribution: Pierre Paul Lefebvre commentedComment #2
kscheirerThe function header for entity_metadata_field_get_language() takes a $field in the 3rd argument, patch looks good to me.
Comment #3
kscheirerAfter further searching through the queue, I think this issue is a duplicate of #1376126: Fix language handling for translatable fields.
Comment #4
mitchell CreditAttribution: mitchell commentedAltering approach in #3, so that #8-#28, in the mentioned issue, are duplicates of this issue.
#25 there (by kalabro) is the same as #1. #27 there confirms the fix, so marking #1 as RTBC.
Comment #5
matthias_mo CreditAttribution: matthias_mo commentedI've created this issue which has the same cause.
Comment #6
fagoThanks, committed.