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.
Use bean together with display_cache, the rendered entity (e.g. in views) will not be displayed.
Comment | File | Size | Author |
---|---|---|---|
#11 | bean-2527008-11-Display-cache-breaks-bean.patch | 874 bytes | geek-merlin |
Comments
Comment #1
geek-merlinentity_view expects entity view callback to use the same (id) key for rendered arrays, not entity name as returned from entity_id.
Patch flying in that fixes this.
Comment #2
iKb CreditAttribution: iKb commentedI got the same problem with entity_embed and this patch solve the issue.
Comment #3
Hanno CreditAttribution: Hanno commentedPatch worked for me as well for entity embed. #2612478: Support for beans
Comment #4
saltednutComment #7
realityloopThis commit breaks views functionality, see #2670862: Views display as Rendered Entity has stopped working for Beans when using bean dev release
Comment #8
skwashd CreditAttribution: skwashd at Dave Hall Consulting for Pfizer, Inc. commentedAs per the discussion on #2670862: Views display as Rendered Entity has stopped working for Beans when using bean dev release I am rolling back commit 3ab5e4e. Any proposed fix for this issue will need tests.
Comment #10
geek-merlinThe patch in #2 had the assumption that incoming entities are keyed by id, which seems to be wrong in general and caused the regression. That was stupid. Memo: A more robust patch will replace entity_id() with entity_extract_ids().
Comment #11
geek-merlinPatch flying in.
Comment #13
geek-merlinHm, CI error... does changing state trigger a re-test?
Comment #18
geek-merlinStrange that PHP 5.4 passes, and PHP 5.3 not. In any case, it's not our problem:
https://dispatcher.drupalci.org/job/default/192196/console
07:03:31 PHP Parse error: syntax error, unexpected T_STRING in /var/www/html/sites/all/modules/uuid/uuid.test on line 13
EDIT: the abov also happens on the main branch, so no problem of this patch.
EDIT: Added UUID issue #2783113: Using trait without PHP 5.4 requirement breaks Drupal CI of all modules that require UUID
Comment #19
geek-merlinComment #20
skwashd CreditAttribution: skwashd at Dave Hall Consulting for Pfizer, Inc. commentedBean now uses PHP 5.4 for running the tests.
Comment #21
geek-merlinOK so patch in#11 passes relevant tests and can be tested/reviewed.
Comment #22
detroz CreditAttribution: detroz commentedHi,
I'm using Views to display some bean blocks.
After applied the #11 patch, somes errors are removed.
But, for each block in my Views, there is an error like that :
Notice : Undefined index: test dans entity_views_plugin_row_entity_view->render() (line 94 on /sites/all/modules/entity/views/plugins/entity_views_plugin_row_entity_view.inc).
In this error, "test" is the admin name of my block.
To remove this errors, I had to alter the "Entity" module.
I changed \entity\views\plugins\entity_views_plugin_row_entity_view.inc like that :
public function render($values) {
if ($entity = $this->get_value($values)) {
// Add the view object as views_plugin_row_node_view::render() would.
// Otherwise the views theme suggestions won't work properly.
$entity->view = $this->view;
- $render = $this->rendered_content[entity_id($this->entity_type, $entity)];
+ if ($this->entity_type == 'bean') {
+ list($id, , ) = entity_extract_ids($this->entity_type, $entity);
+ $render = $this->rendered_content[$id];
+ }
+ else {
+ $render = $this->rendered_content[entity_id($this->entity_type, $entity)];
+ }
return drupal_render($render);
}
}
Maybe, the good correction is to alter the Bean module to use the id instead of the block admin name.
But if this correction can help someone else, ...
Regards,
Comment #23
geek-merlin#22
> Maybe, the good correction is to alter the Bean module to use the id instead of the block admin name.
This is exactly what #11 does. Maybe you missed something or did not clear caches.