I get the following message:
Notice: Trying to get property of non-object in theme_viewreference_display_title() (line 567 of /viewreference.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johnv’s picture

And also the following message, provoked by the same line of coding:
Notice: Undefined index: in theme_viewreference_display_title() (line 567 of viewreference.module)

danielb’s picture

Status: Active » Postponed (maintainer needs more info)

Need steps to reproduce - how is the view configured? Can you suggest the correct code instead of this?

$view->display[$display_key]->display_title

willvincent’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
1022 bytes

The problem with this chunk of code is that it assumes that the view display being attached will have a title set, and that it is an object.

The attached patch resolved this issue for me. FYI - this patch was generated from my local svn repo from the output of 'svn diff'

danielb’s picture

I think those assumptions are reasonable :/ Why wouldn't the display be an object?
Perhaps when the display title is empty or missing we could use the display ID ?
I will try to create a view that has this problem.

I should try to get to the bottom of this because I've contributed very similar code to the views integration in Node reference and User reference: http://drupal.org/project/references

danielb’s picture

Status: Needs review » Closed (cannot reproduce)

I can't reproduce this. I reckon maybe there was something wrong with your view and it needs to be resaved? If you can provide me with steps to reproduce a view that will cause this problem, please reopen.

cmseasy’s picture

Version: 7.x-3.x-dev » 7.x-3.1
Status: Closed (cannot reproduce) » Active

I used a view for View reference with a hidden title and the node body
It generates an error: Notice: Undefined index: in theme_viewreference_display_title() (regel 567 van /public_html/drupal-7/sites/all/modules/viewreference/viewreference.module).

With an unhidden title the error is gone.

I patched view reference with #3: this solved this issue.

Please make this patch a part of the next release.

danielb’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Status: Active » Closed (cannot reproduce)

see #5

james.williams’s picture

Status: Closed (cannot reproduce) » Needs review
FileSize
643 bytes

The issue is caused by viewreference field formatters that output the title, which call through to viewreference_get_view() - which doesn't set the display key that is sent through to the theme function.

The attached patch fixes this, as the display key is just in a different place.

rootd2’s picture

thank you! You patch help me) It's work

rootd2’s picture

Issue summary: View changes

removing private part of path.

nerdoc’s picture

Issue summary: View changes

I can reproduce this bug as well, using viewreference v7.x-3.4, and can confirm that the patch from james.williams fixes this issue. Will this get included into the next release?

danielb’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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