I'd like to extend the behavior of WebformSubmissionStorage's purge method (e.g. to prevent locked submissions from being purged), and add the corresponding elements in the "basic" configuration form for purge options.

The configuration form can probably be enriched by implementing hook_form_alter. But what is the correct approach to extend the purge method ? I don't see how overriding the class could help, so there has to be another way.


1 Answer 1


Try following the buildForm override approach described here: Override buildForm() in another module

This would include overriding the route entity.webform_submission.collection_purge defined in webform.routing.yml

  • Thanks for your suggestion. However submission purging is mostly done by cron, and webform_cron() will call WebformSubmissionStorage->purge so overriding the route won't help. Maybe the correct approach is to create another module with its own cron, its own set of parameters and its own, independant purge function called by cron.
    – linebreak
    Commented Jun 24, 2022 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.