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.
hook_nodequeue_sort_alter() is clearly meant to be able to alter the $nodes when their order is being changed, given its hook name. However, it can't:
module_invoke_all('nodequeue_sort_alter', $sqid, $nodes);
Presumably, module_invoke_all() can't pass by reference. Hence anything I do to $nodes in foo_nodequeue_sort_alter() has no effect, and the hook is pointless.
This needs drupal_alter, and the thing to be altered needs to go first:
drupal_alter('nodequeue_sort', $nodes, $sqid);
Comment | File | Size | Author |
---|---|---|---|
#1 | 1212876.nodequeue.drupal-alter-hook_nodequeue_sort_alter.patch | 613 bytes | joachim |
Comments
Comment #1
joachim CreditAttribution: joachim commentedDon't know if this will fly, as the parameters must be reversed. However, given the hook currently is useless, I doubt anyone has implemented it...
Comment #2
amateescu CreditAttribution: amateescu commentedThis hook was a recent addition from #1110954: Provide a nodequeue_save_subqueue_order_alter hook to allow other modules to respond to and affect the sort so I think we're safe with a warning in the next release.
Commited your patch to 6.x-2.x and 7.x-2.x. Thanks :)
http://drupalcode.org/project/nodequeue.git/commit/2874031
http://drupalcode.org/project/nodequeue.git/commit/3e1df30