function biblio_authors_add_etal in Bibliography Module 6
Same name and namespace in other branches
- 6.2 includes/biblio.contributors.inc \biblio_authors_add_etal()
- 7 includes/biblio.contributors.inc \biblio_authors_add_etal()
- 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
1 call to biblio_authors_add_etal()
- biblio_parse_contributors in ./biblio.contributors.inc 
- Parse initial contributor array and augment with additional info
File
- ./biblio.contributors.inc, line 53 
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;
}