You are here

function globallink_taxonomy_get_strings in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.7 globallink_taxonomy/globallink_taxonomy.inc \globallink_taxonomy_get_strings()
  2. 7.6 globallink_taxonomy/globallink_taxonomy.inc \globallink_taxonomy_get_strings()

Gets taxonomy strings.

Parameters

string $language: The taxonomy language. Defaults to NULL.

string $group: The node group. Defaults to 'taxonomy.'

Return value

array Array of taxonomy strings

File

globallink_taxonomy/globallink_taxonomy.inc, line 208

Code

function globallink_taxonomy_get_strings($language = NULL, $group = 'taxonomy') {
  if (isset($language)) {
    $result = db_query('SELECT s.lid, s.source, s.context, s.location, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.textgroup = :textgroup ORDER BY t.plid, t.plural', array(
      ':language' => $language,
      ':textgroup' => $group,
    ));
  }
  else {
    $result = db_query('SELECT s.lid, s.source, s.context, s.location, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid WHERE s.textgroup = :textgroup ORDER BY t.plid, t.plural', array(
      ':textgroup' => $group,
    ));
  }
  $strings = array();
  foreach ($result as $child) {
    $string = array(
      'lid' => $child->lid,
      'location' => $child->location,
      'source' => $child->source,
      'context' => $child->context,
    );
    $strings[$child->location] = $string;
  }
  return $strings;
}