Context module simply does

foreach (module_implements('block_info') as $module) {

However this means that hook_block_info_alter() never gets called. This means that Context is not compatible with Blockcache Alter module (which changes block cache settings).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dalin’s picture

Status: Active » Needs review
FileSize
2.65 KB

Since this hook will only be implemented if Block module is enabled, then we can let Block module do the heavy lifting.

adamdicarlo’s picture

This isn't specific to Blockcache Alter -- I just ran into this bug when using hook_block_info_alter() to remove blocks from a certain module -- and found they were still on Context's block list.

This patch fixes the problem for me. Here it is rerolled to be compatible with Drush Make, and giving attribution to @dalin.

Only questionable part of the patch is that if the block module is disabled, hook_block_info_alter() still isn't called. Should it be?

adamdicarlo’s picture

Title: Context loads blocks in a manner that never calls hook_block_info_alter() which breaks Blockcache Alter module. » Context block reaction lists blocks without calling hook_block_info_alter().

Hopefully clarifying title.

dalin’s picture

"Only questionable part of the patch is that if the block module is disabled, hook_block_info_alter() still isn't called. Should it be?"

I thought about that too, but if we ignore Context module for a moment, if Block module is not enabled the hook doesn't get called either. Otherwise we have to duplicate _block_rehash() which would not be fun.

Fabianx’s picture

For fixing the blockcache_alter problem:

Here is another patch, which is much simpler and works for D6 and D7 the same.

The only thing it does is retrieve the cache value also from the database, but that works for blockcache_alter in all circumstances.

This is obviously much simpler and does not fix the other problems context has with blocks, but it fixes blockcache_alter and that was what I needed.

Fabianx’s picture

And the D6 version for fixing blockcache_alter with context:

Same approach as D7 version.

Fabianx’s picture

Issue tags: +Performance

Add Performance tag, because with blockcache_alter sites can be much much faster and context is preventing this without this patch.

bastnic’s picture

I must agree with Fabianx. I updated the context_blockcache_alter with his patch and with it everything work without patching anything. But it will be easier to include it directly into context.

bastnic’s picture

Status: Needs review » Reviewed & tested by the community

As I said before, the patch in #5 works perfectly in the context_blockcache_alter, which is used on a number of websites in production.

It gives a real performance boost for almost all website where it's installed, so I set it to reviewed and tested by the community.

tekante’s picture

Status: Reviewed & tested by the community » Fixed

Patch from #2 applied after confirming that it indeed allowed for a hook_block_info_alter to be honored by context. I believe this removes the need for #7 but if not please reopen.

Should be available in the next dev build.
http://drupalcode.org/project/context.git/commit/92d0c33bbe931e99b89f313...

Fabianx’s picture

I need to check this ...

Status: Fixed » Closed (fixed)

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

Fabianx’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Closed (fixed) » Patch (to be ported)

Needs to be ported to D6 still ...

http://drupal.org/node/1251240#comment-5893638

should still work though.

Fabianx’s picture

Issue summary: View changes
Status: Patch (to be ported) » Needs review

Trying a needs review of #6.

paulocs’s picture

As the issue was already fixed in 7.x-3.x-dev branch and 6.x-3.x-dev is no longer supported, I'm updating issue status.
Thanks all.

paulocs’s picture

Status: Needs review » Fixed
paulocs’s picture

Status: Fixed » Closed (fixed)