The "Biblio: Biblio Citation" field is empty when used in a view where the biblio node is linked to the view via a relationship. Other fields appear to work correctly, it's just the citation one that doesn't. The issue can easily be recreated by doing the following:

  • Create a completely clean Drupal site.
  • Enable Views UI, Biblio and Nodereference allowing Drupal to enable the various dependencies.
  • Add a Nodereference field (Label Biblio and name field_biblio) to the page content type linking it to biblio, using all defaults.
  • Create a couple of biblio nodes and a couple of page nodes which link to the biblio nodes.
  • Create a view:
    • Filters: Node: Type = Page
    • Style = Table
    • Add Relationship "Content: Biblio (field_biblio)"
    • Add fields Node: Title, Node: Body, Biblio: Biblio Citation (using Relationship Biblio)

This should give something like http://dev.drupal6.myspecies.info/page_and_biblio , which also shows that the Biblio Node title is correctly linked), whilst I would expect output similar to http://dev.drupal6.myspecies.info/just_biblio , which shows that the citation works when the biblio node is the primary node in the view.

Cheers, Simon

Comments

rjerome’s picture

OK, I know why this doesn't work, but I'm not yet sure how to fix it in an abstract manner. I'll look into the nodereference stuff a bit deeper.

Ron.

rjerome’s picture

I have a bit of a hack if you would like to test it...

Just replace the render function in the biblio_handler_citation.inc file with the following...

  function render($values) {
    $node = node_load($values->nid);
    $base = variable_get('biblio_base', 'biblio');
    $inline = false;
    $nid = false;

    if ($node->type == 'biblio') {
      return theme('biblio_entry', $node, $base, $this->options['style_name'], $inline);
    }
    else {
      foreach (array_keys((array)$values) as $key) {
        if (strstr($key, '_biblio_nid')) {
          $nid = $values->$key;
        }
      }
      if ($nid) {
         $node = node_load($nid);
         return theme('biblio_entry', $node, $base, $this->options['style_name'], $inline);
      }
    }
  }
adr75’s picture

Hello Simon and Ron,

Bit of a newbie question and not sure if this is the appropiate place to ask, but would you mind expanding a bit more on how you managed to set up the biblio relationship? (e.g. node reference set up, view setup) I followed your description, but can't get anything to display with Views.

looplog’s picture

hi Ron,

I've hit up against this issue. It's quite odd, as displaying citations in a view via a nodereference relationship used to work for me (I can give a link to the dev version of my site that works if you like). I tried the code above and it didn't seem to work, though it was an improvement. Rather than not displaying the citation, it just displayed the NID of each reference.

Have you had any progress trying to fix this?

looplog’s picture

Just a follow up. I re-tested the above code and it doesn't display the NID as I stated. So any view using the citation field on a referenced biblio node remains broken.

If there's anything I can do to help this along, let me know.

rjerome’s picture

I haven't had a chance to look at this yet, I'll see if I can get to it tomorrow.

looplog’s picture

Thanks Ron,

In the meantime, a partial workaround is to use Nodereference_views module to output the nodereference as a citation field. It doesn't play well with multiple values though.

molenick’s picture

Version: 6.x-1.x-dev » 6.x-1.14

I encountered this problem as well, and tried out rjerome's code in #2. This workaround works for the most part, except that

        if (strstr($key, '_biblio_nid')) {

doesn't necessarily work for every situation, since I believe that the presence of that key depends on what fields your view is returning. To get this to work, all I had to do was add a field that provided the referenced biblio node's nid, exclude it from display, check for that field, and load the biblio node based on its nid value.

liam morland’s picture

Issue summary: View changes
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.