You are here

function biblio_marc_biblio_export_link in Bibliography Module 7

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

Parameters

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

Return value

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

1 call to biblio_marc_biblio_export_link()
biblio_marc_node_view in modules/marcParse/biblio_marc.module

File

modules/marcParse/biblio_marc.module, line 250

Code

function biblio_marc_biblio_export_link($nid = NULL, $filter = array()) {
  $show_link = variable_get('biblio_export_links', array(
    'marc' => TRUE,
  ));
  if (!isset($show_link['marc']) || empty($show_link['marc']) || !biblio_access('export')) {
    return array();
  }
  $base = variable_get('biblio_base', 'biblio');
  if (module_exists('popups') && !empty($nid)) {
    $link = array(
      'attributes' => array(
        'class' => 'popups',
        'title' => t("Click to get the MARC formatted output"),
      ),
    );
  }
  else {
    $link = array(
      'attributes' => array(
        'title' => t("Click to download the MARC formatted file"),
      ),
    );
  }
  $link['attributes'] += array(
    'rel' => 'nofollow',
  );
  $link['href'] = "{$base}/export/marc";
  if (!empty($nid)) {
    $link['href'] .= '/' . $nid;
  }
  $link['title'] = t('MARC');

  // Add any filters which may be on the current page.
  if (empty($nid) && !empty($filter)) {
    $link['query'] = $filter;
  }
  return array(
    'biblio_marc' => $link,
  );
}