You are here

protected static function LingotekConfigSet::getOpenSet in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekConfigSet.php \LingotekConfigSet::getOpenSet()
1 call to LingotekConfigSet::getOpenSet()
LingotekConfigSet::assignSetId in lib/Drupal/lingotek/LingotekConfigSet.php

File

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

Class

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

Code

protected static function getOpenSet($textgroup) {
  $full_sets = self::getFullSets();
  $query = db_select('lingotek_config_metadata', 'l')
    ->fields('l', array(
    'id',
  ))
    ->condition('config_key', 'textgroup')
    ->condition('value', $textgroup);
  if (!empty($full_sets)) {
    $query
      ->condition('id', $full_sets, 'NOT IN');
  }
  $query
    ->orderBy('id');
  $result = $query
    ->execute();
  $set_ids = $result
    ->fetchCol();
  $open_set_id = FALSE;
  foreach ($set_ids as $key => $set_id) {
    if (!self::hasMaxChars($set_id)) {
      $open_set_id = $set_ids[$key];
      break;
    }
  }
  return $open_set_id;
}