public function SupportTicketRevisionDeleteForm::submitForm in Support Ticketing System 8
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/
support_ticket/ src/ Form/ SupportTicketRevisionDeleteForm.php, line 120 - Contains \Drupal\support_ticket\Form\SupportTicketRevisionDeleteForm.
Class
- SupportTicketRevisionDeleteForm
- Provides a form for reverting a support ticket revision.
Namespace
Drupal\support_ticket\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->supportTicketStorage
->deleteRevision($this->revision
->getRevisionId());
$this
->logger('content')
->notice('@type: deleted %title revision %revision.', array(
'@type' => $this->revision
->bundle(),
'%title' => $this->revision
->label(),
'%revision' => $this->revision
->getRevisionId(),
));
$support_ticket_type = $this->supportTicketTypeStorage
->load($this->revision
->bundle())
->label();
drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array(
'%revision-date' => format_date($this->revision
->getRevisionCreationTime()),
'@type' => $support_ticket_type,
'%title' => $this->revision
->label(),
)));
$form_state
->setRedirect('entity.support_ticket.canonical', array(
'support_ticket' => $this->revision
->id(),
));
if ($this->connection
->query('SELECT COUNT(DISTINCT vid) FROM {support_ticket_field_revision} WHERE stid = :stid', array(
':stid' => $this->revision
->id(),
))
->fetchField() > 1) {
$form_state
->setRedirect('entity.support_ticket.version_history', array(
'support_ticket' => $this->revision
->id(),
));
}
}