protected static function i18n_string_textgroup_default::string_query in Internationalization 7
Build query for i18n_string table
File
- i18n_string/
i18n_string.inc, line 480 - API for internationalization strings
Class
- i18n_string_textgroup_default
- Textgroup handler for i18n_string API
Code
protected static function string_query($context, $multiple = FALSE) {
// Search the database using lid if we've got it or textgroup, context otherwise
$query = db_select('i18n_string', 's')
->fields('s');
if (!empty($context->lid)) {
$query
->condition('s.lid', $context->lid);
}
else {
$query
->condition('s.textgroup', $context->textgroup);
if (!$multiple) {
$query
->condition('s.context', $context->context);
}
else {
// Query multiple strings
foreach (array(
'type',
'objectid',
'property',
) as $field) {
if (!empty($context->{$field})) {
$query
->condition('s.' . $field, $context->{$field});
}
}
}
}
return $query;
}