This is important for things like a module that schedules the appearance of a node inside of a queue on a particular date like news sites.

Comments

greggles’s picture

Status: Active » Needs review
StatusFileSize
new95.99 KB
greggles’s picture

StatusFileSize
new555 bytes

Let's try again.

ezra-g’s picture

Status: Needs review » Needs work

As long as we've already loaded the queue and subqueue objects, any reason not to pass them in the hook definition?

greggles’s picture

Status: Needs work » Needs review
StatusFileSize
new567 bytes

Sure, makes sense.

ezra-g’s picture

Status: Needs review » Reviewed & tested by the community

Seems RTBC to me. Thanks!

greggles’s picture

Title: Provide a nodequeue_sort_alter hook to allow other modules to affect queue sort order » Provide a nodequeue_save_subqueue_order_alter hook to allow other modules to respond to and affect the sort
Status: Reviewed & tested by the community » Needs work

Actually we could/should call this after nodequeue has done it's work. That way other modules can get involved

1) To do their own processing which might be important for some other reason (like saving where the locks are)
2) They can also change the order around as necessary.

greggles’s picture

Status: Needs work » Needs review
StatusFileSize
new2.48 KB

This patch provides that feature I mentioned.

It also lets modules modify the subqueue re-ordering form by adding elements and then passes those along to any module that implements the new nodequeue_save_subqueue_order_alter.

It maintains API consistency for all the current hooks in this area.

I'm calling the new "hook" in a somewhat non-standard way that allows for passing the $nodes by reference. This is actually the new standard way to do it that works with PHP 4.x through 5.3 without throwing errors.

One odd detail to this change:

-  if (count(array_unique($nodes)) < count($nodes)) {
+  if (count(array_unique($nodes, SORT_REGULAR)) < count($nodes)) {

I found with the new practice of including the row data that the comparison had to be "regular" which means that it didn't cast types to something before doing the comparison.

amateescu’s picture

Status: Needs review » Fixed
StatusFileSize
new2.56 KB

Now this is a great patch! Commited to 6.x and 7.x.

http://drupalcode.org/project/nodequeue.git/commit/e841ebe
http://drupalcode.org/project/nodequeue.git/commit/cbafd7c

Attached is the patch that was commited to 7.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.