You are here

function field_collection_entity_language in Field collection 7

Provide the original entity language.

If a language property is defined for the current entity we synchronize the field value using the entity language, otherwise we fall back to LANGUAGE_NONE.

Parameters

$entity_type:

$entity:

Return value

string A language code

4 calls to field_collection_entity_language()
FieldCollectionItemEntity::langcode in ./field_collection.entity.inc
Determines the language code under which the item is stored.
field_collection_field_insert in ./field_collection.module
Implements hook_field_insert().
field_collection_field_update in ./field_collection.module
Implements hook_field_update().
field_collection_item_set_host_entity in ./field_collection.module
Entity property info setter callback for the host entity property.

File

./field_collection.module, line 151
Module implementing field collection field type.

Code

function field_collection_entity_language($entity_type, $entity) {
  if (module_exists('entity_translation') && entity_translation_enabled($entity_type)) {
    $handler = entity_translation_get_handler($entity_type, $entity);
    $langcode = $handler
      ->getLanguage();
  }
  else {
    $langcode = entity_language($entity_type, $entity);
  }
  return !empty($langcode) ? $langcode : LANGUAGE_NONE;
}