nodequeue_subqueue_remove
Drupal 7 nodequeue_subqueue_remove($sqid, $start, $end = NULL)
Remove a node or node(s) from a nodequeue by position.
If you know the nid but but not the position, use
Parameters
$sqid: The subqueue to remove nodes from.
$start: The first position (starting from 1) to remove.
$end: The last position to remove. If NULL or equal to $start, only one node will be removed. Thus if $start is 1 and $end is 2, the first and second items will be removed from the queue.
See also
nodequeue_subqueue_remove_node() instead.
3 calls to nodequeue_subqueue_remove()
File
- sites/
all/ modules/ nodequeue/ nodequeue.module, line 1095 - Maintains queues of nodes in arbitrary order.
Code
function nodequeue_subqueue_remove($sqid, $start, $end = NULL) {
if (!isset($end)) {
$end = $start;
}
// Retrieve the nodes that are being removed.
$result = db_query("SELECT nid FROM {nodequeue_nodes} WHERE sqid = :sqid AND position >= :start AND position <= :end",
array(
':sqid' => $sqid,
':start' => $start,
':end' => $end,
)
);
$diff = $end - $start + 1;
db_delete('nodequeue_nodes')
->condition('sqid', $sqid)
->condition('position', $start, '>=')
->condition('position', $end, '<=')
->execute();
db_update('nodequeue_nodes')
->expression('position', 'position - ' . $diff)
->condition('sqid', $sqid)
->condition('position', $end, '>')
->execute();
// Invoke the hook to let other modules know that the nodes were removed.
foreach ($result as $node) {
module_invoke_all('nodequeue_remove', $sqid, $node->nid);
}
}

