You are here

function theme_biblio_author_link in Bibliography Module 6.2

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

Returns HTML for an author link.

Parameters

array $author: An associative array with information about an author including elements:

  • name: A string with the author's name.
  • cid: An integer identifying the author in biblio module.
  • drupal_uid: (optional) An integer linking to Drupal user ID.
6 theme calls to theme_biblio_author_link()
biblio_style_apa in styles/biblio_style_apa.inc
Apply a bibliographic style to the node
biblio_style_cse in styles/biblio_style_cse.inc
csl_name::render in modules/CiteProc/CSL.inc
theme_biblio_authors in includes/biblio_theme.inc
theme_biblio_format_authors in includes/biblio_theme.inc

... See full list

File

includes/biblio_theme.inc, line 696

Code

function theme_biblio_author_link($author) {
  $base = variable_get('biblio_base', 'biblio');
  $link_to_profile = variable_get('biblio_author_link_profile', 0);
  $link_to_profile_path = variable_get('biblio_author_link_profile_path', 'user/[uid]');
  $options = array();
  $language = isset($node->language) ? $node->language : '';
  if (isset($_GET['sort'])) {
    $options['query']['sort'] = $_GET['sort'];
  }
  if (isset($_GET['order'])) {
    $options['query']['order'] = $_GET['order'];
  }
  if (isset($author['drupal_uid']) && $author['drupal_uid'] > 0) {
    $options['attributes']['class'] = 'biblio-local-author';
  }
  if (variable_get('biblio_links_target_new_window', NULL)) {
    $options = array_merge($options, array(
      'attributes' => array(
        'target' => '_blank',
      ),
      'html' => TRUE,
    ));
  }
  if ($link_to_profile && (isset($author['drupal_uid']) && !empty($author['drupal_uid']))) {
    $data['user'] = user_load($author['drupal_uid']);
    $path = token_replace_multiple($link_to_profile_path, $data);
    $alias = drupal_get_path_alias($path, $language);
    $path_profile = variable_get('biblio_show_profile', '0') ? "{$path}/{$base}" : $alias;
    return l(trim($author['name']), $path_profile, $options);
  }
  else {
    return l(trim($author['name']), "{$base}/author/" . $author['cid'], $options);
  }
  return $html;
}