The entity controller's view method doesn't call the same hooks that other entity view functions do, namely hook_entity_view_alter() and hook_TYPE_view_alter().

Also the view method returns a string instead of an array. template_preprocess_panels_pane, and theme_panels_naked_style_render_pane, theme_panels_block_style_render_pane all appear to support render arrays. If this method can return an array instead, it means I can add contextual links to fieldable_panels_pane entities using the same hooks I use to add them for all entities.

CommentFileSizeAuthor
#2 delegate-render-1555414-2.patch572 byteshelior
#1 fieldable_panels_pane_view_alter-1555414-1.patch655 bytesAnonymous (not verified)

Comments

Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new655 bytes
helior’s picture

Title: Support hook_entity_view_alter(). » Delegate render of content array in PanelsPaneController->View
Category: feature » task
StatusFileSize
new572 bytes

It looks like the alter hook was already added here: http://drupalcode.org/project/fieldable_panels_panes.git/blobdiff/063fbb...

However still, delegating the render of the content will allow hook_panels_pane_content_alter() to attach js/css to the render array, rather than calling drupal_add_*, which is absolutely vital if you're using panel caching.

I'm updating the patch to just skip rendering the content early.

twistor’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

This seems reasonable. We should watch out because it is potentially possible but highly unlikely that someone is calling the view function assuming they'll get rendered content back. However our internal calls appear to all be okay with rendered or unrendered, so this is okay for us.

Committed and pushed.

Status: Fixed » Closed (fixed)

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