Allow webform submissions array to be altered in the pre-purge hooks

Created on 15 February 2023, almost 2 years ago
Updated 25 April 2023, over 1 year ago

Problem/Motivation

A project requires that the purge operation is performed on submissions which are older than X days, except for the locked submissions which should not be deleted until they are unlocked.

The change in https://www.drupal.org/project/webform/issues/3186424 β†’ introduced pre-purge and post-purge hooks, but the hooks are not allowed to alter the array of purgeable submissions prior to actual removal.

Steps to reproduce

1. Enable submissions purging on a webform.
2. Create a hook_webform_submissions_pre_purge() hook in a custom module which sets the passed $webform_submissions to an empty array.
3. See that submissions are purged anyway.

Proposed resolution

Allow pre-purge hooks to alter the passed $webform_submissions array. This requires that the $webform_submissions variable is passed by reference.

This gives more control to the hooks.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Fixed

Version

6.2

Component

Code

Created by

πŸ‡±πŸ‡»Latvia maijs

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024