function lingotek_list_entities_with_field_in_language_by_bundle in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lingotek.util.inc \lingotek_list_entities_with_field_in_language_by_bundle()
- 7.6 lingotek.util.inc \lingotek_list_entities_with_field_in_language_by_bundle()
2 calls to lingotek_list_entities_with_field_in_language_by_bundle()
File
- ./
lingotek.util.inc, line 1297 - Utility functions.
Code
function lingotek_list_entities_with_field_in_language_by_bundle($entity_type, $bundle, $field, $language, $exclude_source = TRUE) {
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', $entity_type);
if (!is_null($bundle)) {
$query
->entityCondition('bundle', $bundle);
}
else {
// Include only the enabled bundle types
$disabled_bundles = lingotek_get_disabled_bundles($entity_type);
if (!empty($disabled_bundles)) {
$query
->entityCondition('bundle', $disabled_bundles, 'NOT IN');
}
}
if ($exclude_source) {
$query
->propertyCondition('language', $language, "!=");
}
$query
->entityCondition('deleted', 0)
->fieldLanguageCondition($field, $language);
$entities = $query
->execute();
return isset($entities['node']) ? array_keys($entities['node']) : array();
}