Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I get the following message:
Notice: Trying to get property of non-object in theme_viewreference_display_title() (line 567 of /viewreference.module).
Comment | File | Size | Author |
---|---|---|---|
#8 | viewreference-notice-1128444-8.patch | 643 bytes | james.williams |
#3 | 1128444.patch | 1022 bytes | willvincent |
Comments
Comment #1
johnvAnd also the following message, provoked by the same line of coding:
Notice: Undefined index: in theme_viewreference_display_title() (line 567 of viewreference.module)
Comment #2
danielb CreditAttribution: danielb commentedNeed steps to reproduce - how is the view configured? Can you suggest the correct code instead of this?
$view->display[$display_key]->display_title
Comment #3
willvincent CreditAttribution: willvincent commentedThe 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'
Comment #4
danielb CreditAttribution: danielb commentedI 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
Comment #5
danielb CreditAttribution: danielb commentedI 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.
Comment #6
cmseasy CreditAttribution: cmseasy commentedI 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.
Comment #7
danielb CreditAttribution: danielb commentedsee #5
Comment #8
james.williams CreditAttribution: james.williams commentedThe 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.
Comment #9
rootd2 CreditAttribution: rootd2 commentedthank you! You patch help me) It's work
Comment #9.0
rootd2 CreditAttribution: rootd2 commentedremoving private part of path.
Comment #10
nerdoc CreditAttribution: nerdoc commentedI 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?
Comment #12
danielb CreditAttribution: danielb commented