You are here

function lingotek_entity_extract_ids in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.5 lingotek.util.inc \lingotek_entity_extract_ids()
  2. 7.6 lingotek.util.inc \lingotek_entity_extract_ids()
16 calls to lingotek_entity_extract_ids()
check_entity_progress_for_download in ./lingotek.sync.inc
LingotekEntity::getBundle in lib/Drupal/lingotek/LingotekEntity.php
Return the bundle for the entity
LingotekEntity::getId in lib/Drupal/lingotek/LingotekEntity.php
Return the node ID
LingotekProfile::loadByEntity in lib/Drupal/lingotek/LingotekProfile.php
lingotek_entity_download in ./lingotek.module

... See full list

File

./lingotek.util.inc, line 2583
Utility functions.

Code

function lingotek_entity_extract_ids($entity_type, $entity) {
  try {
    list($entity_id, $vid, $bundle_name) = entity_extract_ids($entity_type, $entity);
  } catch (EntityMalformedException $ex) {

    // check for non-standard entity types
    if ($entity_type == 'taxonomy_term') {

      // TODO: populate taxonomy_term's entity fields
      $entity_id = $entity->tid;
      $vid = NULL;
      $bundle_name = $entity->type;
    }
    elseif ($entity_type == 'field_collection_item' && is_object($entity)) {
      $entity_id = $entity->item_id;
      $vid = $entity->revision_id;
      $bundle_name = $entity->field_name;
    }
    else {
      $entity_id = NULL;
      $vid = NULL;
      $bundle_name = NULL;
    }
  }
  return array(
    $entity_id,
    $vid,
    $bundle_name,
  );
}