function lingotek_profile_condition in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.util.inc \lingotek_profile_condition()
- 7.4 lingotek.util.inc \lingotek_profile_condition()
- 7.5 lingotek.util.inc \lingotek_profile_condition()
File
- ./
lingotek.util.inc, line 1211 - Utility functions.
Code
function lingotek_profile_condition($entity_type, $table_alias, $table_profile, $profile_id) {
$or = db_or();
$fields = variable_get('lingotek_enabled_fields');
$types = array();
foreach (lingotek_load_profile_defaults($entity_type) as $content_type => $profile) {
if ($profile['profile'] == (string) $profile_id && isset($fields[$entity_type][$content_type])) {
$types[] = $content_type;
}
}
if (!empty($types)) {
$an = db_and();
$an
->condition($table_alias . '.type', $types, 'IN');
$an
->condition($table_profile . '.value', NULL);
$or
->condition($an);
}
$or
->condition($table_profile . '.value', $profile_id);
return $or;
}