You are here

function _entity_translation_label in Entity Translation 7

Returns the appropriate entity label for the given language.

1 call to _entity_translation_label()
entity_translation_overview in ./entity_translation.admin.inc
Translations overview page callback.

File

./entity_translation.admin.inc, line 422
The entity translation user interface.

Code

function _entity_translation_label($entity_type, $entity, $langcode = NULL) {
  if (function_exists('title_entity_label')) {
    list(, , $bundle) = entity_extract_ids($entity_type, $entity);
    $entity_info = entity_get_info($entity_type);
    if (!empty($entity_info['entity keys']['label'])) {
      $legacy_field = $entity_info['entity keys']['label'];
      if (title_field_replacement_enabled($entity_type, $bundle, $legacy_field)) {
        $title = title_entity_label($entity, $entity_type, $langcode);
        if (!empty($title)) {
          return $title;
        }
      }
    }
  }
  return t('view');
}