I've had a quick look around and it seems like there is currently no support for blocks.

I think it would be useful to be able to expire pages if they contain a block that has been added/updated/removed.

It would have to support blocks configured using the Drupal core block system.

As for blocks configured using context or panels or similar modules I don't know whether you would want to support those here or in those modules.

Obviously it wouldn't be possible to handle blocks serving dynamic content if the content updates, it could only handle the action of saving a block.

You could go as far as doing things like expiring pages that contain a menu module block if an item in that menu was updated, but the scope limit for things like that would definitely have to be drupal core blocks only, with the ability for other modules that provide blocks to do the same for themselves.

Comments

rooby’s picture

Issue summary: View changes
chris burge’s picture

There are two issues. The first is how blocks are placed. The second is the block's content. Either should be capable of triggering an expiration.

It would be easy enough to use hook_block_save to trigger an expiration of pages when a block's configuration is updated. This would be useful when changing the places in which a block is displayed using core's block/region system. But that only gets us so far. Blocks are essentially just containers. hook_block_save can trigger an expiration if the block is changed but not its content.

This wouldn't work for a Bean entity. If a Bean entity is updated but its corresponding block is not updated, then hook_block_save won't be triggered. We would need to add Bean support, so that when a Bean entity is updated, we expire all pages on which the Bean is used within the core block/region system. hook_entity_update could be used.

But blocks can also be placed with the Context module. There is no hook provided by Context that corresponds to hook_block_save. So, if a Context is created or edited that places a block we don't have a way to trigger an expiration. We might be able to use hook_form_alter to run a custom function on submission of a Context edit form.

The way I see this working is that we have placement functions (one for core regions and the other for Context), which are called when a block's configuration is changed or a context is changed. We'd also have content functions. If a Bean entity is updated, then we call placement functions and pass them the Bean's block information to expire pages where the Bean is placed by either method.

Note: Panels is already supported in the Expire Panels project. The project added support for Fieldable Panels Panes in 7.x-1.x-dev but does not support Bean entities at the moment.

joseph.olstad’s picture

subscribing, it should be possible that bean entities could trigger expire on entity_save