1 views_handler_field_field.inc | views_handler_field_field::field_language($entity_type, $entity) |
Return the language code of the language the field should be displayed in, according to the settings.
File
- core/
modules/ field/ views/ views_handler_field_field.inc, line 968 - Definition of views_handler_field_field.
Class
- views_handler_field_field
- A field that displays fieldapi fields.
Code
function field_language($entity_type, $entity) {
global $language_content;
if (field_is_translatable($entity_type, $this->field_info)) {
$default_language = language_default();
$language = str_replace(array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'),
array($language_content->langcode, $default_language->langcode),
$this->view->display_handler->options['field_language']);
// Give the Field Language API a chance to fallback to a different language
// (or LANGUAGE_NONE), in case the field has no data for the selected language.
// field_view_field() does this as well, but since the returned language code
// is used before calling it, the fallback needs to happen explicitly.
$language = field_language($entity_type, $entity, $this->field_info['field_name'], $language);
return $language;
}
else {
return LANGUAGE_NONE;
}
}