I have one content type (products) that references another (colour_options) via a select list. I need the list to display more than just the title of the nodes. So I created a view to retreive more data. Now I get an error when trying to add or edit products, or edit the field "field_colour_options". The error is:

Fatal error: Call to a member function render() on a non-object in C:\blahblahblah\sites\all\modules\views\theme\theme.inc on line 168

I'm not sure if this is a views or a CCK issue - I'm also posting it under views.

CommentFileSizeAuthor
#3 cck-fix-nodereference-views.patch859 bytesjpetso

Comments

andershal’s picture

Also posted in views issue tracking: http://drupal.org/node/256441

--
Anders Hal

yelloroadie’s picture

this still seems to be a problem, The views people say it is probably a CCK issue (above link).

jpetso’s picture

Status: Active » Needs review
StatusFileSize
new859 bytes

This error occurs because Nodereference passes the complete $field array to Views, instead of the $field['handler'] object that Views expects. The attached patch fixes this problem, and makes views in nodereferences work again.

Please review and apply.

dropcube’s picture

I confirm the issue:
Fatal error: Call to a member function render() on a non-object in \wwwroot\drupal6-dev\sites\all\modules\views\theme\theme.inc on line 179

Applying the patch at #3 remove the error, however the select box does not show the titles of the node to reference. Changing the widget to the field to autocomplete, neither works.

jpetso : Could you please review and confirm/fix this.

MartinSfromB’s picture

The patch works fine at my site.

dropcube’s picture

Tested again and yes, it works. I was using a 'Node' row style, and it does not display the title of the nodes, 'Fields' row style should be used.

Basic settings
Name: Defaults
Title: None
Style: Unformatted
Row style: Fields
Use AJAX: No
Use pager: Yes
Items per page: 10
More link: No
Distinct: No
Access: Unrestricted
Link display: Page
Header: None
Footer: None
Empty text: None
Theme: Information
karens’s picture

The reason you had trouble is because we have to have the node title in the view and if you don't explicitly add it in, it isn't there. There is a line in the nodereference module a few lines above this line that was intended to ensure the title field got added, but that apparently didn't do the job. I'll play around and find a way to ensure the title gets into the view no matter what kind of view you link to.

karens’s picture

Status: Needs review » Fixed

I just committed a fix. We were already adding the title field to the view, but Views processing jumps past that if the view is not configured to have fields, so I changed the processing a bit so the list of available view includes only views that have fields and added a note to the description saying that only views with fields can be used for this.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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