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 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 commentedI've renamed the function
nodequeue_queue_add().