You are here

function lingotek_get_bean_source in Lingotek Translation 7.7

Loads the source language for bean entity.

5 calls to lingotek_get_bean_source()
LingotekEntity::getSourceLocale in lib/Drupal/lingotek/LingotekEntity.php
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.
lingotek_render_source in ./lingotek.bulk_grid.inc

File

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

Code

function lingotek_get_bean_source($entity_id) {
  $source_language = language_default()->language;
  if (!variable_get('lingotek_translate_beans', FALSE)) {
    return $source_language;
  }
  if (!module_exists('bean')) {
    drupal_set_message(t('The bean module is required.'), 'Warning', FALSE);
    return $source_language;
  }
  $bean_language = db_select('bean', 'bean')
    ->fields('bean', array(
    'language',
  ))
    ->condition('bid', $entity_id)
    ->execute()
    ->fetchField();
  if (!empty($bean_language)) {
    $source_language = $bean_language;
  }
  return $source_language;
}