public function DeleteMultiple::submitForm in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_entity/src/Form/DeleteMultiple.php \Drupal\bibcite_entity\Form\DeleteMultiple::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- modules/
bibcite_entity/ src/ Form/ DeleteMultiple.php, line 123
Class
- DeleteMultiple
- Delete multiple entities form.
Namespace
Drupal\bibcite_entity\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
if ($form_state
->getValue('confirm') && !empty($this->entityInfo)) {
$storage = $this->entityTypeManager
->getStorage($this->entityTypeId);
$entities = $storage
->loadMultiple(array_keys($this->entityInfo));
$storage
->delete($entities);
$this
->logger('bibcite')
->notice('Deleted @count references.', [
'@count' => count($entities),
]);
$this
->messenger()
->addStatus($this
->formatPlural(count($entities), 'Deleted 1 reference.', 'Deleted @count references.'));
$this->tempStore
->delete($this->currentUser
->id());
}
$form_state
->setRedirect('entity.bibcite_reference.collection');
}