I just committed #962694-42: [release blocker] Make Node Reference Relationships Work in Views, that adds relationships for the node_reference and user_reference field types.

Works fine for base properties (node title...), but currently Field API fields added through a noderef relationship do not get displayed.

views_handler_field_field::query() always sets $this->field_alias to 'nid', so the nid of the referenced node isn't seen as a nid to load in pre_render().

views_handler_field_field::query() has this code :

    if (!empty($this->relationship)) {
      foreach ($this->view->relationship as $relationship) {
        if ($relationship->alias == $this->relationship) {
          $base_table = $relationship->definition['base'];
          $base_field = $relationship->definition['base field'];
        }
      }
    }
    ...
    $this->field_alias = $this->query->add_field($base_table, $base_field, '', $params);

and the definition of the relationship in node_reference_field_views_data() has :

        'base' => 'node',
        'base field' => 'nid',

I'm not sure which code is at fault ;-)

Comments

zwhalen’s picture

I seem to have the same problem, though with -alpha1 release. And in my case, the relationship comes from Feeds module (Feeds item: Owner feed).

BarisW’s picture

Subscribing

martijn houtman’s picture

Subscribing.

John Carbone’s picture

Subscribing.

nanpss’s picture

Subscribing

_vl_’s picture

Subscribing

kinesin’s picture

Subscribing

les lim’s picture

Are you sure you're working against dev? Field API fields through referenced nodes are working fine for me.

I'm pretty sure this was resolved here:

http://drupalcode.org/viewvc/drupal/contributions/modules/views/modules/...

yched’s picture

Status: Active » Closed (duplicate)

Doh - I was indeed checking the wrong branch. Looks like I still need to wrap my head around drush / git.drupal.org integration...

This does work in latest 7.x-3.x.

rogueturnip’s picture

subscribing

kbobash’s picture

Subscribing

zwhalen’s picture

#9 is correct. Latest version fixed this issue for me.

klonos’s picture

Status: Closed (duplicate) » Closed (cannot reproduce)

Closed indeed, but not a dupe though ...just clearing things out so that people don't wonder of which issue this is a dupe.

videographics’s picture

Status: Closed (cannot reproduce) » Active

I think this may be related. I was having the problem where the Field API fields weren't showing up at all. Going from alpha to dev fixed that for me but now I get this...

Notice: Undefined index: additional fields in date_field_views_data_alter() (line 252 of /sites/all/modules/date/date_views/date_views.module).
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in date_field_views_data_alter() (line 252 of /sites/all/modules/date/date_views/date_views.module).
.
.
.

Is it possible that dates (with their multiple values) are not being handled properly by views or is this an issue with the date module?

dawehner’s picture

Status: Active » Fixed

This problem was already reported against the date module: #1032942: Undefined index #date_format in date_popup_process_date()/date_popup_date_granularity()/, date_popup.module
It's the right place to do this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.