You are here

public function biblio_handler_citation::pre_render in Bibliography Module 7

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

File

views/biblio_handler_citation.inc, line 71

Class

biblio_handler_citation

Code

public function pre_render(&$values) {
  $nids = array();
  $nodes = array();
  foreach ($values as $result) {
    if (!empty($result->{$this->aliases['nid']})) {
      $nids[] = $result->{$this->aliases['nid']};
    }
  }
  if ($nids) {
    $langcode = $GLOBALS['language_content']->language;
    $nodes = node_load_multiple($nids);
    if (!empty($nodes)) {
      field_attach_prepare_view('node', $nodes, 'full', $langcode);
      entity_prepare_view('node', $nodes, $langcode);
      foreach ($values as $key => $result) {
        if (isset($result->{$this->aliases['nid']})) {
          $values[$key]->node = $nodes[$result->{$this->aliases['nid']}];
        }
      }
    }
  }
}