You are here

function lingotek_entity_info_alter in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.2 lingotek.module \lingotek_entity_info_alter()
  2. 7.3 lingotek.module \lingotek_entity_info_alter()
  3. 7.4 lingotek.module \lingotek_entity_info_alter()
  4. 7.5 lingotek.module \lingotek_entity_info_alter()
  5. 7.6 lingotek.module \lingotek_entity_info_alter()

Implements hook_entity_info_alter().

File

./lingotek.module, line 2176

Code

function lingotek_entity_info_alter(&$entity_info) {
  $profiles = lingotek_get_profiles();
  $field_translation = FALSE;

  //Check if there is any active profile that's using field Translation.
  foreach ($profiles as $profile) {
    if ($profile
      ->getUsage() > 0 && !$profile
      ->isNodeBased()) {
      $field_translation = TRUE;
      break;
    }
  }
  if (isset($entity_info['comment'])) {
    $entity_info['comment']['translation']['lingotek'] = $field_translation;
  }
  if (isset($entity_info['field_collection_item'])) {
    $entity_info['field_collection_item']['translation']['lingotek'] = $field_translation;
  }
  if (isset($entity_info['message_type'])) {
    $entity_info['message_type']['translation']['lingotek'] = $field_translation;
  }
  if (isset($entity_info['taxonomy_term'])) {
    $entity_info['taxonomy_term']['translation']['lingotek'] = $field_translation;
  }
}