It would be great if we could expose specific views filters and sorts for each node queue. I'm encountering use-cases where I have nodes in multiple queues, but in a given view I really only care about filtering (or more likely sorting) from one specific queue. I think something along the lines of the code below can work:

  $qids = nodequeue_get_all_qids(NULL); // get 'em all
  foreach ($qids as $qid) {
    $tables['nodequeue_nodes_'. $qid] = array(
      "name" => "nodequeue_nodes",
      "join" => array(
        "left" => array(
          "table" => "node",
          "field" => "nid"
        ),
        "right" => array(
          "field" => "nid"
        ),
        'extra' => array(
          'qid' => $qid,
        ),
      ),
      "sorts" => array(
        "position" => array(
          'name' => t("NodeQueue: Queue Position in $qid"),
          'field' => 'position',
          'help' => t('When sorting by queue position, be sure the view is filtered to a single queue or the sort will not work very well.'),
        ),
      ),
    );
  }
  return $tables;

Comments

joshk’s picture

Yeah, the above code is working out (I have it stuckin my own custom_module_views.inc). The one thing it really needs is to identify the queues by name rather than number in the UI. E.g. "Nodequeue: Position in Featured Blogs" rather than "Position in Queue 2"

merlinofchaos’s picture

I don't understand what you're trying to accomplish that can't be accomplished by filtering to the queue you want, and then sorting on position.

joshk’s picture

I don't want to filter to a queue. I want a view that will show data in/out of queue (or possibly in multiple queues), but favor items based on their position (if any) in one particular queue. Think of it as "sticky at the top of lists" on steroids.

merlinofchaos’s picture

Status: Active » Fixed

Committed something like this. I'm not 100% happy with it, but it it'll have to do.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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