You are here

function _biblio_format_author in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.pages.inc \_biblio_format_author()
  2. 6 biblio.pages.inc \_biblio_format_author()
  3. 7.2 includes/biblio.pages.inc \_biblio_format_author()

Helper function to format the authors and add edit links if required.

1 call to _biblio_format_author()
_biblio_format_author_page in includes/biblio.pages.inc

File

includes/biblio.pages.inc, line 1355
Copyright (C) 2006-2011 Ron Jerome.

Code

function _biblio_format_author($author) {
  if ($author->literal) {
    $name = $author->name;
  }
  else {
    $name = $author->lastname;
    $name .= !empty($author->firstname) ? ', ' . drupal_substr($author->firstname, 0, 1) . '.' : (!empty($author->initials) ? ', ' . $author->initials : '');
  }
  $uri['path'] = variable_get('biblio_base', 'biblio');
  $uri['query']['f']['author'] = $author->cid;
  $uri['attributes'] = array();
  if (isset($author->drupal_uid) && $author->drupal_uid > 0) {
    $uri['attributes'] += array(
      'class' => array(
        'biblio-local-author',
      ),
    );
  }
  if (variable_get('biblio_links_target_new_window', NULL)) {
    $uri['attributes'] += array(
      'target' => '_blank',
    );
    $uri['html'] = TRUE;
  }
  $name = l(trim($name), $uri['path'], $uri);

  // $format = biblio_format_authors(array($author));
  $name .= ' (' . $author->cnt . ') ' . (biblio_access('edit_author') ? _biblio_author_edit_links($author) : '');
  if (biblio_access('edit_author') && isset($author->suspect)) {
    $name = '<div class="suspect">' . $name . '</div>';
  }
  return $name;
}