The default CCK field handler (views_handler_field_content) adds the node type field to the view query because several formatters rely on its presence. However, it incorrectly assumes that the field's table alias is 'node' for fields that are included in the view via a relationship (as is potentially the case when using Content Profile).

I've created a patch that checks the relationship of the field and correctly adds the node type field to the query based on it. Please review the patch and consider rolling into core.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

Makes sense.
Isn't there a more direct way than $this->view->display['default']->handler->handlers['relationship'][$this->options['relationship']] to access this info ? I know that information is duplicated in the view.

yched’s picture

Status: Needs review » Fixed

OK, I committed something along those lines. Thanks !

jhuckabee’s picture

You may have already caught this, but I just found a bug with this patch. It fails to properly check the 'none' relationship case. I've attached an updated patch.

Should be

if (isset($this->options['relationship']) && $this->options['relationship'] != 'none') {

instead of just

if (isset($this->options['relationship'])) {
yched’s picture

Actually, no, I had not caught this. Thanks.

yched’s picture

After talking with merlinofchaos, it appears 'additional fields' take care of relationships, so I eventually committed a different fix for this.
Thanks for pointing this, though.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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