You are here

public function TestPurgeHandler::prePurge in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/modules/webform_test_handler/src/Plugin/WebformHandler/TestPurgeHandler.php \Drupal\webform_test_handler\Plugin\WebformHandler\TestPurgeHandler::prePurge()

Acts on webform submissions before they are purged.

Used before the entities are purged and before they are deleted.

Parameters

\Drupal\webform\WebformSubmissionInterface[] $webform_submissions: The webform submissions to be purged.

Overrides WebformHandlerBase::prePurge

File

tests/modules/webform_test_handler/src/Plugin/WebformHandler/TestPurgeHandler.php, line 23

Class

TestPurgeHandler
Defines a handler that interacts with the submission purge APIs.

Namespace

Drupal\webform_test_handler\Plugin\WebformHandler

Code

public function prePurge(array $webform_submissions) {
  \Drupal::state()
    ->set('webform_test_purge_handler_pre', array_map(function (WebformSubmissionInterface $submission) {
    return $submission
      ->id();
  }, $webform_submissions));
  parent::prePurge($webform_submissions);
}