You are here

function biblio_authors_add_etal in Bibliography Module 7.2

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 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

1 call to biblio_authors_add_etal()
biblio_parse_contributors in includes/biblio.contributors.inc
Parse initial contributor array and augment with additional info

File

includes/biblio.contributors.inc, line 86

Code

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

    // et al author should be added only once per type
    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;
}