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.
At the moment it is possible to add nodes to a nodequeue programmatically, but it requires the developer to understand the concept of subqueues, which might seem daunting to some.
Could we add a simple function which allows developers to do exactly what can be achieved on the GUI at admin/structure/nodequeue/%, something like this:
/**
* Add a node to a nodequeue.
*
* @param $queue_name
* A machine-readable name of the nodequeue.
* @param $nid
* The nid of the node to add.
*/
function nodequeue_add_node_to_queue($queue_name, $nid) {
$queue = nodequeue_load_queue_by_name($queue_name);
$subqueues = nodequeue_load_subqueues_by_queue($queue->qid);
foreach ($subqueues as $subqueue) {
nodequeue_subqueue_add($queue, $subqueue, $nid);
}
}
A related, more ambitious issue is #373174: Export and import capability for nodequeue .
Comments
Comment #2
fizk CreditAttribution: fizk commentedGreat idea :) I'm always creating this kind of custom function when working with nodequeue. Might as well add it to the project ;)
Comment #3
fizk CreditAttribution: fizk commentedI've renamed the function
nodequeue_queue_add().