You are here

function lingotek_get_group_source in Lingotek Translation 7.7

Loads a source language for a group type

7 calls to lingotek_get_group_source()
LingotekEntity::getSourceLocale in lib/Drupal/lingotek/LingotekEntity.php
LingotekEntity::setLanguage in lib/Drupal/lingotek/LingotekEntity.php
Set the entity's language to be used by Lingotek, which will sometimes be different from the stated Drupal language.
lingotek_entity_langcode in ./lingotek.util.inc
lingotek_entity_load_single in ./lingotek.module
lingotek_entity_xml_body in ./lingotek.util.inc
Return the xml representation of the source content for an entity.

... See full list

File

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

Code

function lingotek_get_group_source($entity_id) {
  if (!module_exists('entity_translation')) {
    drupal_set_message(t('The Entity Translation module is required for translation of Group module types.'), 'warning', FALSE);
    return language_default()->language;
  }
  $row = db_select('entity_translation', 'et')
    ->fields('et')
    ->condition('entity_type', 'group')
    ->condition('entity_id', $entity_id)
    ->condition('source', '')
    ->execute()
    ->fetch(PDO::FETCH_ASSOC);
  return $row['language'];
}