You are here

function _lingotek_update_bean_source_language in Lingotek Translation 7.7

Updates bean source language.

1 call to _lingotek_update_bean_source_language()
lingotek_entity_update in ./lingotek.module
Implements hook_entity_update().

File

./lingotek.module, line 1648

Code

function _lingotek_update_bean_source_language($entity, $type) {
  if ($type !== 'bean' || empty($entity->language) || !variable_get('lingotek_translate_beans', FALSE)) {
    return;
  }
  $bean_update = db_update('bean')
    ->fields(array(
    'language' => $entity->language,
  ))
    ->condition('bid', $entity->bid, '=')
    ->execute();
  if (!$bean_update) {
    LingotekLog::trace('Update bean block with source language has failed.');
    return;
  }
  LingotekLog::trace('Bean block source language has been updated.');
}