The only available hook for reordering is hook_nodequeue_swap($sqid, $nid). looking at the code, this hook is only called from nodequeue_queue_swap. nodequeue_queue_swap is itself only called from nodequeue_subqueue_shuffle, nodequeue_queue_up and nodequeue_queue_down. Any other way to reorder a subqueue (ie. nodequeue_queue_front, nodequeue_queue_back, nodequeue_set_subqueue_positions and nodequeue_save_subqueue_order) will not trigger any reordering hook.
This means a module can ot plug itslef into the reordering of subqueue like it can for node addition and removal.
We need this feature for one of our project (we need to track changes in queues) and I'm willing to work on a patch for this. Calling hook_nodequeue_swap() mutliple times for each nodes in a reordered subqueue seems inneficient. I plan to add an additional hook_nodequeue_reorder($sqid) triggered after completion of any reordering operation.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | nq_992326_2_reorder_hook.patch | 2.76 KB | katbailey |
| #1 | nodequeue_992326_1_hook_nodequeue_reorder.patch | 2.72 KB | pbuyle |
Comments
Comment #1
pbuyle commentedHere is a simple patch adding
hook_nodequeue_reorder($sqid).Comment #2
polApplied successfully on nodequeue 6.x-2.9, I succeeded to do what I want ;-)
Patch working flawlessly !
Comment #4
polWeird, I applied the patch without any error!
Comment #5
eric_a commentedFails due to #996512: D6 contrib project tests: [MySQL] Drupal installation failed..
Comment #6
pbuyle commented#1: nodequeue_992326_1_hook_nodequeue_reorder.patch queued for re-testing.
Comment #8
katbailey commentedGlad to see that someone has already beat me to adding this issue, could really use this extra hook. Don't know what the problem is with the patch so am just adding a re-roll to see if we can get beyond the current impasse...
Comment #9
amateescu commentedFixed in #1110954: Provide a nodequeue_save_subqueue_order_alter hook to allow other modules to respond to and affect the sort.