You are here

function biblio_load_contributors_multiple in Bibliography Module 7

Same name and namespace in other branches
  1. 7.2 includes/biblio.contributors.inc \biblio_load_contributors_multiple()

Parameters

$vids:

$auth_category:

Return value

multitype:|Ambigous <multitype:, array>

3 calls to biblio_load_contributors_multiple()
biblio_handler_field_contributor::post_execute in views/biblio_handler_field_contributor.inc
Run after the view is executed, before the result is cached.
biblio_load in ./biblio.module
Implements hook_load().
biblio_load_contributors in includes/biblio.contributors.inc

File

includes/biblio.contributors.inc, line 140

Code

function biblio_load_contributors_multiple($vids = array(), $auth_category = 0) {
  $contributors = array();
  if (empty($vids)) {
    return $contributors;
  }
  $query = db_select('biblio_contributor', 'bc');
  $query
    ->innerJoin('biblio_contributor_data', 'bcd', 'bcd.cid = bc.cid');
  $query
    ->fields('bc');
  $query
    ->fields('bcd');
  $query
    ->orderby('bc.vid');
  $query
    ->orderby('bc.rank');
  if (count($vids) == 1) {
    $query
      ->condition('bc.vid', $vids[0]);
  }
  else {
    $query
      ->condition('bc.vid', $vids, 'IN');
  }
  if ($auth_category) {
    $query
      ->condition('bc.auth_category', $auth_category);
  }
  $query
    ->addMetaData('base_table', 'biblio_contributor');
  $query
    ->addTag('node_access');
  $result = $query
    ->execute();
  foreach ($result as $creator) {
    $contributors[$creator->vid][] = (array) $creator;
  }
  return $contributors;
}