You are here

function globallink_block_get_strings in GlobalLink Connect for Drupal 7.5

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

Retrieves strings for all blocks.

Parameters

string $language: The blocks' $language. Defaults to NULL.

string $group: The Drupal content type. Defaults to 'blocks.'

Return value

array Array of strings for blocks.

4 calls to globallink_block_get_strings()
globallink_block_get_translated_blocks in globallink_block/globallink_block.inc
Gets number of translated blocks.
globallink_block_get_translations_for_row_id in globallink_block/globallink_block_receive.inc
Gets block translations by row ID.
globallink_block_receive_form in globallink_block/globallink_block_receive.inc
Builds form to receive a block submission.
globallink_block_send_blocks_for_translations in globallink_block/globallink_block.inc
Sends blocks for translation.

File

globallink_block/globallink_block.inc, line 144

Code

function globallink_block_get_strings($language = NULL, $group = 'blocks') {
  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;
}