public function GroupRevisionDeleteForm::submitForm in Group 8
Same name and namespace in other branches
- 2.0.x src/Entity/Form/GroupRevisionDeleteForm.php \Drupal\group\Entity\Form\GroupRevisionDeleteForm::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
- src/
Entity/ Form/ GroupRevisionDeleteForm.php, line 101
Class
- GroupRevisionDeleteForm
- Provides a form for deleting a group revision.
Namespace
Drupal\group\Entity\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->groupStorage
->deleteRevision($this->revision
->getRevisionId());
$group_type = $this->revision
->getGroupType();
$this
->logger('content')
->notice('@type: deleted %title revision %revision.', [
'@type' => $group_type
->label(),
'%title' => $this->revision
->label(),
'%revision' => $this->revision
->getRevisionId(),
]);
$this
->messenger()
->addStatus($this
->t('Revision from %revision-date of @type %title has been deleted.', [
'%revision-date' => $this->dateFormatter
->format($this->revision
->getRevisionCreationTime()),
'@type' => $group_type,
'%title' => $this->revision
->label(),
]));
$redirect_route = 'entity.group.canonical';
if ($this
->countRevisions($this->revision) > 1) {
$redirect_route = 'entity.group.version_history';
}
$form_state
->setRedirect($redirect_route, [
'group' => $this->revision
->id(),
]);
}