You are here

function biblio_link in Bibliography Module 6

Same name and namespace in other branches
  1. 5 biblio.module \biblio_link()
  2. 6.2 biblio.module \biblio_link()

Implementation of hook_link().

This is implemented so that an edit link is displayed for users who have the rights to edit a node.

File

./biblio.module, line 448

Code

function biblio_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  $base = variable_get('biblio_base', 'biblio');
  if ($type == 'node' && $node->type == 'biblio') {

    // Don't display a redundant edit link if they are node administrators.
    if (biblio_access('update', $node) && !user_access('administer nodes')) {
      $links['biblio_edit'] = array(
        'title' => t('edit this entry'),
        'href' => "node/{$node->nid}/edit",
      );
    }
    if (biblio_access('export', $node)) {
      module_load_include('inc', 'biblio', 'biblio_theme');
      $show_link = variable_get('biblio_export_links', array(
        'tagged' => TRUE,
        'xml' => TRUE,
        'bibtex' => TRUE,
      ));
      $show_link['google'] = variable_get('biblio_google_link', 1);
      if ($show_link['tagged']) {
        $links['biblio_tagged'] = _build_biblio_tagged_link($base, $node->nid);
      }
      if ($show_link['xml']) {
        $links['biblio_xml'] = _build_biblio_xml_link($base, $node->nid);
      }
      if ($show_link['bibtex']) {
        $links['biblio_bibtex'] = _build_biblio_bibtex_link($base, $node->nid);
      }
      if ($show_link['google']) {
        $links['biblio_google_scholar'] = _build_google_scholar_link($node);
      }
    }
  }
  return $links;
}