I have a view where I get the relevant nodes via a relationship from an Entity Reference field. Now when I want to get the Disqus comment count with the views field using the relationship, I get this error: "Notice: Undefined property: stdClass::$nid in views_handler_field_node_disqus_comment_count->render() (Line 39 of [...]/sites/all/modules/contrib/disqus/disqus.views.inc)." That's caused by the field handlers render method trying to access $values->nid, but that does not exist, because the field containing the nid is coming from the relationship, so it is actually stored in $values->node_field_data_field_entityreference_nid (where field_entityreference would be the field holding the reference to the relevant nodes).
Something is wrong in the handler, I think it has to do with overriding the query method with an empty method. I removed that and changed the real_field in the init method to 'nid', because that is the actual field we need to make the render method work. I really don't know what I am doing, but my patch does work for me as far as I can see.
Comment | File | Size | Author |
---|---|---|---|
#3 | disqus-views_with_relationship-3.patch | 1.1 KB | evanjenkins |
disqus-views_relationship.patch | 963 bytes | Volx | |
Comments
Comment #1
slashrsm CreditAttribution: slashrsm commentedWhy not
Comment #2
jockium CreditAttribution: jockium commentedSame problem here...
However the proposed patch doesn't work...
the node comes from a relasionship ( Taxonomy term: Content with term ), but "$this->field_alias" has a value of "unknown"
Any ideas anyone?
Comment #3
evanjenkins CreditAttribution: evanjenkins commentedI was able to fix this issue with the attached patch.