You are here

function biblio_bibtex_biblio_export_link in Bibliography Module 7.2

Same name and namespace in other branches
  1. 6.2 modules/bibtexParse/biblio_bibtex.module \biblio_bibtex_biblio_export_link()
  2. 7 modules/bibtexParse/biblio_bibtex.module \biblio_bibtex_biblio_export_link()

Creates a link to export a node (or view) in BibTEX format

Parameters

$base this is the base url (defaults to /biblio):

$nid the node id, if NULL then the current view is exported:

Return value

a link (<a href=...>BibTEX</a>)

1 call to biblio_bibtex_biblio_export_link()
biblio_bibtex_entity_view in modules/bibtexParse/biblio_bibtex.module
Implements hook_entity_view().

File

modules/bibtexParse/biblio_bibtex.module, line 121

Code

function biblio_bibtex_biblio_export_link($bid = NULL, $filter = array()) {
  $show_link = variable_get('biblio_export_links', array(
    'bibtex' => TRUE,
  ));
  if (!$show_link['bibtex'] || !biblio_access('export')) {
    return array();
  }
  $base = variable_get('biblio_base', 'biblio');
  if (module_exists('popups') && !empty($bid)) {
    $link = array(
      'attributes' => array(
        'class' => 'popups',
        'title' => t("Click to get the BibTEX output"),
      ),
    );
  }
  else {
    $link = array(
      'attributes' => array(
        'title' => t("Click to download the BibTEX formatted file"),
      ),
    );
  }
  $link['href'] = "{$base}/export/bibtex";
  if (!empty($bid)) {
    $link['href'] .= '/' . $bid;
  }
  $link['title'] = t('BibTex');
  if (empty($bid) && !empty($filter)) {

    // add any filters which may be on the current page
    $link['query'] = $filter;
  }
  return array(
    'biblio_bibtex' => $link,
  );
}