function languagefield_field_prepare_view in Custom Language field 7
Implements hook_field_prepare_view().
File
- ./
languagefield.module, line 176 - Provides a list of languages from ISO 639 standard. All variables of a $language-object can be found here: http://api.drupal.org/api/drupal/developer--globals.php/global/language
Code
function languagefield_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
// Get all possible languages, even if not settable.
$languages = _languagefield_options(NULL, $langcode);
foreach ($entities as $id => $object) {
foreach ($items[$id] as $delta => $item) {
// Check if item value is set, otherwise continue to next item.
if (!empty($item['value'])) {
$items[$id][$delta] = $languages[$item['value']];
}
}
}
}