You are here

function theme_biblio_authors in Bibliography Module 6.2

Same name and namespace in other branches
  1. 6 biblio_theme.inc \theme_biblio_authors()

Parameters

array $contributors:

string $style: (optional)

integer $cat: (optional)

bool $inline: (optional)

string $glue: (optional)

1 theme call to theme_biblio_authors()
biblio_style_apa in styles/biblio_style_apa.inc
Apply a bibliographic style to the node

File

includes/biblio_theme.inc, line 338

Code

function theme_biblio_authors($contributors, $style = 'classic', $cat = 1, $inline = false, $glue = ', ') {

  // Immediately return if there are no contributors
  if (empty($contributors)) {

    // @todo: Shouldn't this return any empty string?
    return;
  }
  $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'])) {

      // This is needed for form preview to fill in all fields.
      $author = biblio_parse_author($author, $cat);
    }
    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;
}