function biblio_parse_contributors in Bibliography Module 6.2
Same name and namespace in other branches
- 6 biblio.contributors.inc \biblio_parse_contributors()
- 7.2 includes/biblio.contributors.inc \biblio_parse_contributors()
Parses array of contributors and augments with additional information.
Parameters
array $contributors: Array of contibutor arrays
Return value
array|null An array of enhanced author arrays.
1 call to biblio_parse_contributors()
- _biblio_move_authors in ./
biblio.install - Moves author data into biblio_contributor* tables.
File
- includes/
biblio.contributors.inc, line 149 - Functions related to contributors in Drupal biblio module.
Code
function biblio_parse_contributors($contributors) {
$result = array();
if (count($contributors) < 1) {
// @todo: Should something be returned here?
return;
}
foreach ($contributors as $category => $authors) {
$etal = array();
foreach ($authors as $author) {
// Remove any form of "et al" from name element for biblio_parse_author().
$author_cleaned = preg_replace("/et\\.?\\s+al\\.?/", '', $author['name']);
// If "et al" was present, store cleaned version for parsing.
if ($author_cleaned != $author['name']) {
$author['name'] = $author_cleaned;
// Mark this author as "to be added" in $etal array
$etal[$author['auth_type']] = TRUE;
}
$author['name'] = trim($author['name']);
if (strlen($author['name'])) {
$result[$category][] = biblio_parse_author($author, $category);
}
}
// Add "et al" authors for all neccessary contrbutor categories
foreach ($etal as $type => $dummy) {
// Add "et al" only if plain authors exists.
if (isset($result[$category])) {
biblio_authors_add_etal($result[$category], $type);
}
}
}
return $result;
}