You are here

function biblio_authors_add_etal in Bibliography Module 6.2

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

Adds additional author named "et al" to the end of the author array.

Parameters

$authors -: Array of author arrays to possibly augment.

integer $type: Integer ID representing the author type.

Return value

bool TRUE if author was added, FALSE if "et al" already present.

1 call to biblio_authors_add_etal()
biblio_parse_contributors in includes/biblio.contributors.inc
Parses array of contributors and augments with additional information.

File

includes/biblio.contributors.inc, line 126
Functions related to contributors in Drupal biblio module.

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