public function YamlFormSubmissionStorage::delete in YAML Form 8
Deletes permanently saved entities.
Parameters
array $entities: An array of entity objects to delete.
Throws
\Drupal\Core\Entity\EntityStorageException In case of failures, an exception is thrown.
Overrides SqlContentEntityStorage::delete
1 call to YamlFormSubmissionStorage::delete()
- YamlFormSubmissionStorage::deleteAll in src/
YamlFormSubmissionStorage.php - Delete all form submissions.
File
- src/
YamlFormSubmissionStorage.php, line 594
Class
- YamlFormSubmissionStorage
- Defines the form submission storage.
Namespace
Drupal\yamlformCode
public function delete(array $entities) {
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $entity */
if (!$entities) {
// If no entities were passed, do nothing.
return;
}
foreach ($entities as $entity) {
$this
->invokeYamlFormElements('preDelete', $entity);
$this
->invokeYamlFormHandlers('preDelete', $entity);
}
$return = parent::delete($entities);
$this
->deleteData($entities);
foreach ($entities as $entity) {
$this
->invokeYamlFormElements('postDelete', $entity);
$this
->invokeYamlFormHandlers('postDelete', $entity);
}
// Log deleted.
foreach ($entities as $entity) {
\Drupal::logger('yamlform')
->notice('Deleted @form: Submission #@id.', [
'@id' => $entity
->id(),
'@form' => $entity
->getYamlForm()
->label(),
]);
}
return $return;
}