I have a problem with the EMW. For example, a node with $node->language = 'fr' and $node->field_foobar only has 'fr' translation.

$wrapper = entity_metadata_wrapper('node', $node);
$wrapper->language('de');
print $wrapper->field_foobar->value();

The above code returns the field value in French language instead of the expected German language. And it's independant on the Entity Translation fallback language setting.

I debug and found that this behavior was introduced in a 2012 commit. I guess there is a logic to always have the fallback = TRUE when we get the field value, I just don't know what it is.

+  $langcode = isset($options['language']) ? $options['language']->language : LANGUAGE_NONE;
+  $langcode = entity_metadata_field_get_language($entity_type, $entity, $field, $langcode, TRUE);

Comments

jcisio created an issue. See original summary.

jcisio’s picture

Status: Active » Closed (duplicate)