Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to implement hook_nodequeue_remove to prevent a queue going down to zero.
function mymodule_nodequeue_remove($sqid, $nid) {
$subqueue = nodequeue_load_subqueue($sqid, TRUE);
dsm($subqueue);
if ($subqueue->count == 0) {
dsm('EMPTY!!!!');
}
This code doesn't work.
When I remove the last node in nodequeue admin, the count is given as 1. When I remove the last node on the node's nodequeue tab, the count is given as 0. Hence I can't reliably test whether the node being removed is the final one.
(I've tried the patch at #959450: hook_nodequeue_remove gets called twice when a node is removed from a subqueue., which has no effect on this bug.)
Comment | File | Size | Author |
---|---|---|---|
#1 | 1048994-nodequeue_count_in_hook_nodequeue_remove_is_unreliable-D6.patch | 642 bytes | amateescu |
#1 | 1048994-nodequeue_count_in_hook_nodequeue_remove_is_unreliable.patch | 642 bytes | amateescu |
Comments
Comment #1
amateescu CreditAttribution: amateescu commentedFixed with attached patches in 6.x and 7.x.
http://drupalcode.org/project/nodequeue.git/commit/38cc835
http://drupalcode.org/project/nodequeue.git/commit/d4f2eed
Comment #3
joachim CreditAttribution: joachim commentedThis is still a problem.
If I remove more than one node in the queue admin page, then only the last one gets the hook invoked:
Comment #4
joachim CreditAttribution: joachim commentedActually, filing this problem as a new bug as it impacts other things and it's to do with the whole form rather than just this piece of code: http://drupal.org/node/1212896