function i18n_string_load_multiple in Internationalization 7
Load multiple strings, including string source
Parameters
$conditions: Array of conditions for i18n_string table.
Return value
$strings List of i18n string objects
2 calls to i18n_string_load_multiple()
- i18n_string_get_by_lid in i18n_string/
i18n_string.module - Get full string object by lid.
- i18n_string_textgroup_default::load_strings in i18n_string/
i18n_string.inc - Load multiple strings.
File
- i18n_string/
i18n_string.module, line 486 - Internationalization (i18n) package - translatable strings.
Code
function i18n_string_load_multiple($conditions) {
// The primary table here will be i18n_string, though we add source too.
$query = db_select('i18n_string', 'i')
->fields('i');
$query
->leftJoin('locales_source', 's', 'i.lid = s.lid');
$query
->fields('s', array(
'source',
'version',
'location',
));
// Add text group condition and add conditions to the query
foreach ($conditions as $field => $value) {
$alias = in_array($field, array(
'source',
'version',
'location',
)) ? 's' : 'i';
$query
->condition($alias . '.' . $field, $value);
}
// this patch is a workaround for core file bug in file
// include/database/prefetch.inc (see: http://drupal.org/node/1567216)
// return $query->execute()->fetchAll(PDO::FETCH_CLASS, 'i18n_string_object');
$stmt = $query
->execute();
$stmt
->setFetchMode(PDO::FETCH_CLASS, 'i18n_string_object');
return $stmt
->fetchAll();
}