Is there an Integration for Panels? Or better: can i Load an configured ajaxblock into a pane?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maximpodorov’s picture

I didn't try it with Panels. Could you try and share your results?

patrickroma’s picture

Actually it does not work... The ajaxblock does not load at all... I think it is because panels is creating different classes CSS and does not render the usual regions...
There is at this point no module for D6 that does a similar feature...

There is Block Refresh in D7 implementing it => http://drupal.org/node/1272556

Could this also be achieved with Ajax Blocks?

EDIT: Maybe also related: http://drupal.org/node/443208#comment-5415010

maximpodorov’s picture

When using as panes, blocks are not processed by hook_preprocess_block() hooks, so Ajaxblocks module can't see them. Could someone familiar with Panels internals suggest the alternative way to process blocks through Ajaxblocks module during panel rendering stage?

beanluc’s picture

I found something in the Panels issue queue to suggest that hook_preprocess_HOOK(&$vars) might not work reliably through panels, but that hook_preprocess(&$vars, $HOOK) should work.

Consider http://drupal.org/node/334209#comment-3321442, where HOOK is "page" but I've generalized the discussion to include the "block" theme implementation or whatever else.

patrickroma’s picture

Interesting point... Still I am not sure how to implement it to ajax blocks...

beanluc’s picture

When using as panes, blocks are not processed by hook_preprocess_block() hooks

someone familiar with Panels internals suggest the alternative way to process blocks

Try, instead of ajaxblocks_preprocess_block(&$vars), this way ajaxblocks_preprocess(&$vars, 'block')

I haven't tried it, I'm just saying that this is what the Panels discussion indicates.

I hope it helps.

maximpodorov’s picture

Ajax blocks does work with panels. For the required blocks you have to change the style to "System block" in pane context menu, so the standard block theming will be used.
The solution was found here: #258377: BlockTheme not working.
Maybe module documentation should be updated.

loparr’s picture

This solution works.
In a case that you have one ajax block displayed as normal block in theme and the same block displayed by panels even with system block style - block displayed by panels doesn't load.

maximpodorov’s picture

@loparr, how is it possible to show two blocks with the same ID?

loparr’s picture

In my case it is a combination of panels and theme blocks on one page.

maximpodorov’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)
MikeActually’s picture

Version: 6.x-1.8 » 7.x-1.x-dev
Component: Documentation » Code
Category: Support request » Feature request
Status: Closed (works as designed) » Needs work
FileSize
860 bytes

This definitely needs work, but this patch will at least render a block that is inside of a panel.

Where it falls short is that it isn't actually rendering the pane, but the block itself; with that it is also not passing arguments to the block that might normally be set within the panel pane. Visibility rules should still be recognized.

To get this to work, you'll need to configure the ajax settings for the block in the block admin, once set, this will show up in the ajaxpagers database table, and then when the panel is preprocessed, it will render the block as if it is an ajaxblock.

The final solution to this should do the following:

  • check if panels is installed
  • hook the form for panes to have an ajaxblocks form embedded (possibly using the same form schema for block configuration
  • instead of rendering the block, the pane should be rendered; with arguments
  • this may require a check to see if the item is a pane, and use a function of panels/panes to render, instead of the drupal module_invoke for block_view (maybe there's a module invoke for pane view??)

I needed this patch to solve a caching issue for a poll inside of a pane. I will revisit it in a few weeks to try and flesh out the above.

If anyone has anything to add to this to help get this closer to a real feature, I'd really appreciate it.