You are here

function theme_biblio_author_link in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio_theme.inc \theme_biblio_author_link()
  2. 6 biblio_theme.inc \theme_biblio_author_link()
  3. 7.2 includes/biblio.theme.inc \theme_biblio_author_link()
5 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
Apply a bibliographic style to the node.
csl_name::render in modules/CiteProc/CSL.inc
theme_biblio_format_authors in includes/biblio_theme.inc
theme_biblio_long in includes/biblio_theme.inc
Theme function for biblio_long.

File

includes/biblio_theme.inc, line 661

Code

function theme_biblio_author_link($variables) {
  $base = variable_get('biblio_base', 'biblio');
  $author = $variables['author'];
  $options = isset($variables['options']) ? $variables['options'] : array();
  $link_to_profile = variable_get('biblio_author_link_profile', 0);
  $link_to_profile_path = variable_get('biblio_author_link_profile_path', 'user/[user:uid]');
  $uri = drupal_parse_url(request_uri());
  $uri = array_merge($uri, $options);
  if (!isset($uri['attributes'])) {
    $uri['attributes'] = array(
      'rel' => 'nofollow',
    );
  }
  $path = $uri['path'];
  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;
  }
  if ($link_to_profile && isset($author['drupal_uid']) && $author['drupal_uid'] > 0) {
    $data['user'] = user_load($author['drupal_uid']);
    $path = token_replace($link_to_profile_path, $data);
    $alias = drupal_get_path_alias($path);
    $path_profile = variable_get('biblio_show_profile', '0') ? "{$path}/{$base}" : $alias;
    return l(trim($author['name']), $path_profile, $uri);
  }
  else {
    $uri['path'] = variable_get('biblio_base', 'biblio');
    $uri['query']['f']['author'] = $author['cid'];
    return l(trim($author['name']), $uri['path'], $uri);
  }
}