public function HeartbeatStreamRevisionDeleteForm::submitForm in Heartbeat 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
- src/
Form/ HeartbeatStreamRevisionDeleteForm.php, line 106
Class
- HeartbeatStreamRevisionDeleteForm
- Provides a form for deleting a Heartbeat stream revision.
Namespace
Drupal\heartbeat\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->HeartbeatStreamStorage
->deleteRevision($this->revision
->getRevisionId());
$this
->logger('content')
->notice('Heartbeat stream: deleted %title revision %revision.', array(
'%title' => $this->revision
->label(),
'%revision' => $this->revision
->getRevisionId(),
));
drupal_set_message(t('Revision from %revision-date of Heartbeat stream %title has been deleted.', array(
'%revision-date' => format_date($this->revision
->getRevisionCreationTime()),
'%title' => $this->revision
->label(),
)));
$form_state
->setRedirect('entity.heartbeat_stream.canonical', array(
'heartbeat_stream' => $this->revision
->id(),
));
if ($this->connection
->query('SELECT COUNT(DISTINCT vid) FROM {heartbeat_stream_field_revision} WHERE id = :id', array(
':id' => $this->revision
->id(),
))
->fetchField() > 1) {
$form_state
->setRedirect('entity.heartbeat_stream.version_history', array(
'heartbeat_stream' => $this->revision
->id(),
));
}
}