You are here

function theme_biblio_authors in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 includes/biblio_theme.inc \theme_biblio_authors()
1 theme call to theme_biblio_authors()
biblio_style_apa in ./biblio_style_apa.inc
Apply a bibliographic style to the node

File

./biblio_theme.inc, line 303

Code

function theme_biblio_authors($contributors, $style = 'classic', $cat = 1, $inline = false, $glue = ', ') {
  if (empty($contributors)) {
    return;
  }

  // t('No author information available');
  $author_style_function = '_' . $style . '_format_author';
  $author_links = variable_get('biblio_author_links', 1);
  $base = variable_get('biblio_base', 'biblio');
  foreach ($contributors as $key => $author) {
    if (!empty($author['name']) && !isset($author['lastname'])) {
      $author = biblio_parse_author($author, $cat);

      // this is needed for form preview to fill in all fields
    }
    if (strlen($author['name'])) {
      ${$author}['name'] = $author_style_function($author);
      if ($author_links) {
        $format = theme('biblio_author_link', $author);
      }

      // add the auth_type as css id to allow later formatting
      $author_array[] = '<span id="' . $author['auth_type'] . '">' . $format . '</span>';
    }
  }
  if (empty($author_array)) {
    return '';
  }
  $output = '<span class="biblio_authors">';
  $output .= implode($glue, $author_array);
  $output .= '</span>';
  return $output;
}