You are here

function biblio_authors_add_etal in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.contributors.inc \biblio_authors_add_etal()
  2. 6 biblio.contributors.inc \biblio_authors_add_etal()
  3. 7.2 includes/biblio.contributors.inc \biblio_authors_add_etal()

Add separate author named "et al" to the end of the author array.

Parameters

$authors:

  • author array to augment

$type:

  • auth_type

Return value

TRUE if author was added, FALSE if "etal" was already there

File

includes/biblio.contributors.inc, line 182

Code

function biblio_authors_add_etal(&$authors, $type) {
  $etal = "et al";
  $max_rank = 0;

  // Et al author should be added only once per type.
  foreach ($authors as $author) {
    if ($author['auth_type'] != $type) {
      continue;
    }
    if ($author['name'] == $etal) {
      return FALSE;
    }
    $max_rank = max($max_rank, $author['rank']);
  }
  $authors[] = biblio_parse_author(array(
    'name' => $etal,
    'auth_type' => $type,
    'lastname' => $etal,
    'rank' => $max_rank + 1,
  ));
  return TRUE;
}