You are here

public static function PrepareUninstallForm::purgeFieldData in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Form/PrepareUninstallForm.php \Drupal\simplenews\Form\PrepareUninstallForm::purgeFieldData()
  2. 3.x src/Form/PrepareUninstallForm.php \Drupal\simplenews\Form\PrepareUninstallForm::purgeFieldData()

Purges a field data.

File

src/Form/PrepareUninstallForm.php, line 89

Class

PrepareUninstallForm
Removes fields and data used by Simplenews.

Namespace

Drupal\simplenews\Form

Code

public static function purgeFieldData() {
  do {
    field_purge_batch(1000);
    $properties = [
      'deleted' => TRUE,
      'include_deleted' => TRUE,
    ];
    $fields = \Drupal::entityTypeManager()
      ->getStorage('field_config')
      ->loadByProperties($properties);
  } while ($fields);
}