function lingotek_field_language_alter in Lingotek Translation 7.2
Same name and namespace in other branches
- 7.7 lingotek.module \lingotek_field_language_alter()
- 7.3 lingotek.module \lingotek_field_language_alter()
- 7.4 lingotek.module \lingotek_field_language_alter()
- 7.5 lingotek.module \lingotek_field_language_alter()
- 7.6 lingotek.module \lingotek_field_language_alter()
Implements hook_field_language_alter().
File
- ./
lingotek.module, line 1245
Code
function lingotek_field_language_alter(&$display_language, $context) {
// Comments may be in a state where content only exists in the source language
// because Lingotek translation hasn't finished yet, or synchonization with
// Lingotek hasn't yet occurred. In this case, fall back to displaying
// the default language for each field.
foreach ($display_language as $field => $display_language_code) {
if (!isset($context['entity']->{$field}[$display_language_code])) {
$display_language[$field] = $context['entity']->language;
}
}
}