Commit 7224b77e authored by fago's avatar fago

Added support for adding in translations of allowed field values via i18n field module.

parent d9baed7a
......@@ -485,8 +485,15 @@ function entity_metadata_field_options_list($name, $info) {
// No data available.
$entity = NULL;
}
$instance = $wrapper->getBundle() ? field_info_instance($wrapper->type(), $name, $wrapper->getBundle()) : NULL;
return (array) module_invoke($field['module'], 'options_list', $field, $instance, $wrapper->type(), $entity);
// Support translating labels via i18n field.
if (module_exists('i18n_field') && ($translate = i18n_field_type_info($field['type'], 'translate_options'))) {
return $translate($field);
}
else {
$instance = $wrapper->getBundle() ? field_info_instance($wrapper->type(), $name, $wrapper->getBundle()) : NULL;
return (array) module_invoke($field['module'], 'options_list', $field, $instance, $wrapper->type(), $entity);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment