You are here

function nodequeue_handler_field_all_queues::pre_render in Nodequeue 7.2

Same name and namespace in other branches
  1. 6.2 includes/views/nodequeue_handler_field_all_queues.inc \nodequeue_handler_field_all_queues::pre_render()
  2. 7.3 includes/views/nodequeue_handler_field_all_queues.inc \nodequeue_handler_field_all_queues::pre_render()

Run before any fields are rendered.

This gives the handlers some time to set up before any handler has been rendered.

Parameters

array $values: An array of all objects returned from the query.

Overrides views_handler_field::pre_render

1 method overrides nodequeue_handler_field_all_queues::pre_render()
nodequeue_handler_field_all_subqueues::pre_render in includes/views/nodequeue_handler_field_all_subqueues.inc
Run before any fields are rendered.

File

includes/views/nodequeue_handler_field_all_queues.inc, line 57
Field handler for all queues.

Class

nodequeue_handler_field_all_queues
@file Field handler for all queues.

Code

function pre_render(&$values) {
  $nids = array();
  foreach ($values as $result) {
    $nids[] = $result->{$this->field_alias};
  }
  if ($nids) {
    $query = db_select('nodequeue_nodes', 'nn');
    $query
      ->innerJoin('nodequeue_queue', 'nq', 'nn.qid = nq.qid');
    $query
      ->fields('nn', array(
      'nid',
      'qid',
    ));
    $query
      ->fields('nq', array(
      'title',
    ));
    $query
      ->orderby('nq.title');
    $query
      ->condition('nn.nid', $nids);
    $qids = array_filter($this->options['qids']);
    if (!empty($this->options['limit']) && !empty($qids)) {
      $query
        ->condition('nn.qid', $qids);
    }
    $result = $query
      ->execute();
    foreach ($result as $queue) {
      $this->items[$queue->nid][$queue->qid]['title'] = check_plain($queue->title);
      if (!empty($this->options['link_to_queue'])) {
        $this->items[$queue->nid][$queue->qid]['make_link'] = TRUE;
        $this->items[$queue->nid][$queue->qid]['path'] = 'admin/structure/nodequeue/' . $queue->qid;
      }
    }
  }
}