I'm a little confused as to the handling of the Biblio Export Links in biblio.module and biblio.theme.inc.

biblio.theme.inc seems to use a themable function for the <ul> that it generates:

function theme_biblio_export_links($node = NULL) {
  $base = variable_get('biblio_base', 'biblio');
  $show_link = variable_get('biblio_export_links', array('tagged' => TRUE, 'xml' => TRUE, 'bibtex' => TRUE));
  $show_link['google'] = variable_get('biblio_google_link', 1);

  $links = '';
  $links .= '<ul class="biblio-export-buttons">';
  if ($show_link['tagged']) $links .= '<li> '. _build_biblio_link($base, $node, 'tagged') .'</li>';
  if ($show_link['xml'])    $links .= '<li> '. _build_biblio_link($base, $node, 'xml') .'</li>';
  if ($show_link['bibtex']) $links .= '<li> '. _build_biblio_link($base, $node, 'bibtex') .'</li>';
  if ($show_link['google'] && !empty($node))
                            $links .= '<li> '. _build_biblio_link($base, $node, 'google') .'</li>';
  $links .= '</ul>';
  return $links;
}

However, biblio.module seems to be passing the export links to the $links array:


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)) {
      $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;
}

Thus if you're using a themable function override in your template.php, the export links are being output to the screen twice.

I would think that the themable function approach would be preferable, and have the building of each individual link also use a themable (rather than a private) function.

Thanks!

Comments

rjerome’s picture

Agreed, that is a little inconsistent. I moved those to hook_link without much thought of the repercussions. I'll rethink that with theming in mind.

Siekee’s picture

I noticed the new feature to toggle on/of export links in 6x.
How could I do that in 5.x-1.17? That is: I don't want them at all.
Thx.

rjerome’s picture

You can disable them by removing the 'show export links' permission for the selected group.

Ron.

liam morland’s picture

Status: Active » Closed (outdated)

This version is no longer maintained. If this issue is still relevant to the Drupal 7 version, please re-open and provide details.