You are here

function biblio_pm_link in Bibliography Module 6.2

Same name and namespace in other branches
  1. 6 pubmed/biblio_pm.module \biblio_pm_link()
1 call to biblio_pm_link()
biblio_pm_biblio_lookup_link in modules/pubmed/biblio_pm.module

File

modules/pubmed/biblio_pm.module, line 240

Code

function biblio_pm_link($type, $node = NULL, $teaser = FALSE) {
  $show_link = variable_get('biblio_lookup_links', array(
    'pubmed' => TRUE,
  ));
  if (!isset($show_link['pubmed']) || !$show_link['pubmed'] || !isset($node) || $node->type != 'biblio' || !isset($node->biblio_pubmed_id)) {
    return array();
  }
  if (isset($node) && $type == 'node' && $node->type == 'biblio' && !empty($node->biblio_pubmed_id)) {
    $link = 'http://www.ncbi.nlm.nih.gov/pubmed/' . $node->biblio_pubmed_id . '?dopt=Abstract';
    $attrs = array(
      'title' => t("Click to view the PubMed listing for this node"),
    );
    if (variable_get('biblio_links_target_new_window', null)) {
      $attrs = array_merge($attrs, array(
        'target' => '_blank',
      ));
    }
    return array(
      'biblio_pubmed' => array(
        'title' => t('PubMed'),
        'href' => $link,
        'attributes' => $attrs,
      ),
    );
  }
  return;
}