Closed (fixed)
Project:
Webform
Version:
7.x-3.18
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Jan 2013 at 18:36 UTC
Updated:
15 Aug 2013 at 02:51 UTC
Jump to comment: Most recent file
After changing the "Available as block" advanced setting for a webform, it does not show up in a blockreference select list until we actually visit the admin>settings>block page.
A workaround adds the following hook to our module:
/**
* Implements hook_node_insert().
*/
function custom_module_node_insert($node) {
block_flush_caches();
}
The patch below adds `block_flush_caches();` to both webform_node_insert and webform_node_update.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | webform_block_flush_caches-1891552.patch | 733 bytes | quicksketch |
| webform_node_insert.patch | 987 bytes | a-fro |
Comments
Comment #1
james.williamsWorks great for me. This will also be useful for other modules that integrate with blocks that rely on the blocks table without doing a rehash.
Comment #2
quicksketchThis patch would be better if it checked $node->original in hook_node_update() to see if the block status changed. That would make it so that disabling a block would automatically remove it from the list, and it would prevent rebuilding the block list every time a node was updated. The hook_node_insert() implementation looks good.
Comment #3
quicksketchHere's an updated patch that checks $node->original (or actually just $original, since we've already shortened this variable) in hook_node_update().
Comment #4
quicksketchTested on D7 branches and things look good. Committed and pushed.