Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
So I limitted the submissions of users to 1 per day.
After they submit the from in the block, the form hides but the block title and block body frame still remain. I even tried to give <none>
title to webform block, but the small themed empty block body still remains even though there's nothing to display at all.
Thanks for your time.
Comment | File | Size | Author |
---|---|---|---|
#2 | webform_empty_block-d7.patch | 502 bytes | quicksketch |
Comments
Comment #1
trigdog CreditAttribution: trigdog commentedI was also wondering this. I have my form block on the user's profile page and it just clutters up their page once they have submitted the form since they can only submit the form once. If the following code is added to the webform_block_view hook in webform.module (I added it after the node access check) it seems to hide the block if the user submission limit has been reached. However, I am not sure if this is the correct way to do this or if the cache check is needed since it is a block. Hopefully someone else with more knowledge of the webform module can tell us if this is possible.
Edit: Looking at webform_submission_user_limit_check, if webform_submissions has a lot of entries, this might decrease performance on pages that the block is loading even if it isn't being displayed since it has to do this check every time.
Comment #2
quicksketchThanks, I've confirmed this problem in the latest code. Looks like it's because we're passing back a renderable array which contains a lot of content. However when the renderable is actually run, it doesn't return anything. To prevent the block from showing up, we can build the content sooner which lets block module know that the block is empty. I've committed this patch which fixes the problem, which seems to only affect D7.
Comment #3
quicksketchComment #4
trigdog CreditAttribution: trigdog commentedThank you :) Got it working with your patch!