function lingotek_keystore_delete_multiple in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.util.inc \lingotek_keystore_delete_multiple()
- 7.5 lingotek.util.inc \lingotek_keystore_delete_multiple()
Helper function to delete a specified variable from multiple nodes in the Lingotek table
Parameters
int array $entity_ids: array of node ids for the variable that needs to be deleted if a single nid is passed in, it will be converted to an array before processing
string $lingokey: variable name to be deleted
string $condition: additional condition checking (i.e. 'LIKE', '<' '=' '>', etc...) defaults to '='
1 call to lingotek_keystore_delete_multiple()
- lingotek_entity_disassociate_form_submit in ./
lingotek.bulk_grid.inc - Submit handler for the lingotek_entity_disassociate form.
File
- ./
lingotek.util.inc, line 161 - Utility functions.
Code
function lingotek_keystore_delete_multiple($entity_type, $entity_ids, $lingokey, $condition = '=') {
if (!is_array($entity_ids)) {
$entity_ids = array(
$entity_ids,
);
}
$query = db_select('lingotek_entity_metadata', 'l')
->fields('l', array(
'entity_id',
))
->condition('entity_type', $entity_type)
->condition('entity_id', $entity_ids, 'IN')
->condition('entity_key', $lingokey, $condition);
$delete_nids = $query
->execute()
->fetchCol();
if (!empty($delete_nids)) {
$delete = db_delete('lingotek_entity_metadata')
->condition('entity_type', $entity_type)
->condition('entity_id', $delete_nids, 'IN')
->condition('entity_key', $lingokey, $condition)
->execute();
}
}