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'm getting a notice:
Undefined property: entityreference_plugin_display::$id_field_alias in entityreference_plugin_style->render() (line 50 of [...]/views/entityreference_plugin_style.inc).
When the view I attach to an invalid argument (which causes the query to not exectute and therefore entityreference_plugin_display::query() to not complete). Simple fix is to add
class entityreference_plugin_display extends views_plugin_display {
public $id_field_alias;
To the top of the class.
Comment | File | Size | Author |
---|---|---|---|
#1 | entityreference-id_field_alias-notice-2043161-1.patch | 423 bytes | JamesAn |
Comments
Comment #1
JamesAn CreditAttribution: JamesAn commentedI can confirm this bug as well as that one-liner fix against version 7.x-1.1. Here's that the proposed fix rolled into a patch against the 7.x-1.x branch.
Comment #2
loopduplicateI got this error when my view used a contextual filter for "Content: Language" and set the "WHEN THE FILTER VALUE IS NOT AVAILABLE" field to "Display contents of 'No results found"'". I switched this to "Hide view" and the php notice went away.
Regards,
loopduplicate
Comment #3
TwoDI don't know if it's always safe to use an empty value for the property when there are no results, but this patch does seem to work.
Comment #4
sano CreditAttribution: sano commentedThe patch worked for me. Thanks.
Entity reference 7.x-1.5
Comment #5
FireHawkX CreditAttribution: FireHawkX commentedThis also fixed the notice error for me on latest dev version! :)
Thanks!
Comment #6
MustangGB CreditAttribution: MustangGB commentedYup, still working here too.
Comment #8
minorOffense CreditAttribution: minorOffense at Coldfront Labs Inc. commentedThanks!
Comment #10
joseph.olstadhttps://www.drupal.org/project/entityreference/releases/7.x-1.6-rc2
Comment #11
joseph.olstadhttps://www.drupal.org/project/entityreference/releases/7.x-1.7
Comment #12
joseph.olstadplease try the latest release
https://www.drupal.org/project/entityreference/releases/7.x-1.9