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 can use entityreference fields to reference bean entities without problems, however when I want to display the bean using the "Rendered Entity" formatter, an "empty" bean is output. The view function of the bean plugin is never called.
As a workaround I have written a custom formatter just for beans, which I'll attach.
Comment | File | Size | Author |
---|---|---|---|
#6 | 1891210-view_callback-6.patch | 957 bytes | guillaumev |
#1 | entityreference_bean_formatter.txt | 722 bytes | valderama |
Comments
Comment #1
valderama CreditAttribution: valderama commentedBtw, I am using these versions:
Entity API 7.x-1.0
Entity Reference 7.x-1.0
Bean 7.x-1.0-rc8
And attached is my formatter...
Comment #2
DamienMcKennaThis works for me with the latest 1.0 release of EntityReference. However, similar to #1858416: Rendered bean does not display the title when display settings indicate it should, it does not display the bean title, just the bean's content. Maybe there should be an option to include the title?
Comment #3
DamienMcKennaWhat field are you outputting? The title field currently is not displayed (see #1858416), so unless you have other fields it won't work.
Comment #4
valderama CreditAttribution: valderama commentedActually, I am using a bean which does not have fields, but its content is generated from the view function of the plugin. Like those bean-types: http://drupal.org/project/bean_twitter_pull and http://drupal.org/project/bean_tax
I can verify that fields attached to the bean are rendered indeed.
Any hints for how to fix this are welcome.. Thanks!
Comment #5
akalata CreditAttribution: akalata commentedI ran into this as well -- could not get the single field on the bean to appear. I had used the existing field_body field, specified via Entity Reference and displayed via Display Suite. Creating a new field instead of re-using field_body worked for me.
Comment #6
guillaumev CreditAttribution: guillaumev commentedThe same problem exists when you try to display a bean using views: given that BeanPlugin->view is never called, you might end up with just the field of the bean entity while what you want to display is actually the result of the call to BeanPlugin->view.
Here is a patch that fixes it for me (and should fix it as well for EntityReference I believe).
Comment #7
indytechcook CreditAttribution: indytechcook commentedThanks for the patch. It's always to good think to keep implementing more parts of the entity api. Who knows what other integrations this fixes.
https://drupal.org/commitlog/commit/22232/57f967f184463b9ba127631ab58f98...