public function OrganizationRevisionDeleteForm::submitForm in Drupal PM (Project Management) 4.x
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/
pm_organization/ src/ Form/ OrganizationRevisionDeleteForm.php, line 99
Class
- OrganizationRevisionDeleteForm
- Provides a form for deleting a Organization revision.
Namespace
Drupal\pm_organization\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->OrganizationStorage
->deleteRevision($this->revision
->getRevisionId());
$this
->logger('content')
->notice('Organization: deleted %title revision %revision.', [
'%title' => $this->revision
->label(),
'%revision' => $this->revision
->getRevisionId(),
]);
$this
->messenger()
->addMessage(t('Revision from %revision-date of Organization %title has been deleted.', [
'%revision-date' => $this->dateFormatter
->format($this->revision
->getRevisionCreationTime()),
'%title' => $this->revision
->label(),
]));
$form_state
->setRedirect('entity.pm_organization.canonical', [
'pm_organization' => $this->revision
->id(),
]);
if ($this->connection
->query('SELECT COUNT(DISTINCT vid) FROM {pm_organization_field_revision} WHERE id = :id', [
':id' => $this->revision
->id(),
])
->fetchField() > 1) {
$form_state
->setRedirect('entity.pm_organization.version_history', [
'pm_organization' => $this->revision
->id(),
]);
}
}