Hi,
If you have a webform set to "Available as Block" and have it entered somewhere in the block assignments then turn off the webform's block availability without removing it from the blocks assignments first it appears that it continues to be processed by the site anyway. I found this while dealing with this issue, https://www.drupal.org/node/2352209, when a form containing a file field had its block availability disabled and the 2 cache entries continued to happen on every single page load until I turn its block availability back on, removed it from the blocks, then turned off its block availability.
Committed to 7.x-4.x and 8.x. Note that I believe blocks are implemented quite differently in Drupal 8. I committed this patch not because it will work in D8, but so that there is a record of the issue and the D8 webform implementer can decide what corrective action might be needed to prevent webform blocks from being displayed when they should not be.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | webform-persistent_webform_block-2356549-4.patch | 1.79 KB | danchadwick |
Comments
Comment #1
swickham commentedComment #2
danchadwick commentedUgh. There is no API to delete a block that belongs to a module. We would have to reach into the block tables and delete it ourself.
Alternatively, we could hide the block (again by updating the block table directly), leaving the block. This would have the advantage that the block's configuration would not be lost, but it is leaving cruft in the database.
Or last we could check for the block's status in the block itself. The leaves the processing in for the block, but would short circuit the generation.
Three not very attractive options.
Comment #3
danchadwick commentedComment #4
danchadwick commentedI spend quite a bit of time on this, investigating and reporting the Drupal 7 core bug relating to deleting blocks which are no longer available. I changed the submit handler to detect when a block has been marked as no longer available, and to delete any existing configured block.
To correct this issue in an existing database, re-enable making webform blocks available, save, and then disable making webform blocks available. Existing blocks will be removed then.
The patch only corrects the problem for subsequent uses of the Form Settings tab, not prior database inconsistency.
Comment #7
danchadwick commented