You are here

protected static function LingotekConfigSet::assignSetId in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekConfigSet.php \LingotekConfigSet::assignSetId()
1 call to LingotekConfigSet::assignSetId()
LingotekConfigSet::getSetId in lib/Drupal/lingotek/LingotekConfigSet.php
Return the set ID for a given segment from the locales source

File

lib/Drupal/lingotek/LingotekConfigSet.php, line 196
Defines LingotekConfigSet.

Class

LingotekConfigSet
A class wrapper for Lingotek-specific behavior on ConfigSets.

Code

protected static function assignSetId($lid) {

  // get the $lid's textgroup
  $textgroup = db_select('locales_source', 'l')
    ->fields('l', array(
    'textgroup',
  ))
    ->condition('lid', $lid)
    ->execute()
    ->fetchField();
  $open_set_id = self::getOpenSet($textgroup);
  if ($open_set_id === FALSE) {
    $open_set_id = self::createSet($textgroup);
  }

  // assign lid to that set
  db_merge('lingotek_config_map')
    ->key(array(
    'lid' => $lid,
  ))
    ->fields(array(
    'lid' => $lid,
    'set_id' => $open_set_id,
  ))
    ->execute();
  return $open_set_id;
}