function views_handler_field_field::field_language
3.x 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.
2 calls to views_handler_field_field::field_language()
- views_handler_field_field::get_value in modules/
field/ views_handler_field_field.inc - Get the value that's supposed to be rendered.
- views_handler_field_field::set_items in modules/
field/ views_handler_field_field.inc - Return an array of items for the field.
File
- modules/
field/ views_handler_field_field.inc, line 913 - 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');
$language = str_replace(array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'),
array($language_content->language, $default_language),
$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;
}
}