Use bean together with display_cache, the rendered entity (e.g. in views) will not be displayed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

geek-merlin’s picture

Status: Active » Needs review
FileSize
879 bytes

entity_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.

iKb’s picture

Status: Needs review » Reviewed & tested by the community

I got the same problem with entity_embed and this patch solve the issue.

Hanno’s picture

Patch worked for me as well for entity embed. #2612478: Support for beans

saltednut’s picture

Status: Reviewed & tested by the community » Fixed

  • brantwynn committed 3ab5e4e on 7.x-1.x authored by axel.rutz
    Issue #2527008 by axel.rutz: Display cache breaks bean display
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

realityloop’s picture

Status: Closed (fixed) » Needs work
skwashd’s picture

Issue tags: +Needs tests

As 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.

  • skwashd committed 7a232f9 on 7.x-1.x
    Revert "Issue #2527008 by axel.rutz: Display cache breaks bean display...
geek-merlin’s picture

The 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().

geek-merlin’s picture

Status: Needs work » Needs review
FileSize
874 bytes

Patch flying in.

Status: Needs review » Needs work

The last submitted patch, 11: bean-2527008-11-Display-cache-breaks-bean.patch, failed testing.

geek-merlin’s picture

Status: Needs work » Needs review

Hm, CI error... does changing state trigger a re-test?

Status: Needs review » Needs work

The last submitted patch, 11: bean-2527008-11-Display-cache-breaks-bean.patch, failed testing.

The last submitted patch, 11: bean-2527008-11-Display-cache-breaks-bean.patch, failed testing.

The last submitted patch, 11: bean-2527008-11-Display-cache-breaks-bean.patch, failed testing.

The last submitted patch, 11: bean-2527008-11-Display-cache-breaks-bean.patch, failed testing.

geek-merlin’s picture

Strange 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

geek-merlin’s picture

Status: Needs work » Needs review
skwashd’s picture

Bean now uses PHP 5.4 for running the tests.

geek-merlin’s picture

OK so patch in#11 passes relevant tests and can be tested/reviewed.

detroz’s picture

Hi,

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,

geek-merlin’s picture

#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.