public function OpignoActivityRevisionRevertForm::submitForm in Opigno module 8
Same name and namespace in other branches
- 3.x src/Form/OpignoActivityRevisionRevertForm.php \Drupal\opigno_module\Form\OpignoActivityRevisionRevertForm::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/
Form/ OpignoActivityRevisionRevertForm.php, line 109
Class
- OpignoActivityRevisionRevertForm
- Provides a form for reverting a Answer revision.
Namespace
Drupal\opigno_module\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// The revision timestamp will be updated when the revision is saved.
$this->revision = $this
->prepareRevertedRevision($this->revision);
$this->revision
->save();
$this
->logger('content')
->notice('Answer: reverted %title revision %revision.', [
'%title' => $this->revision
->label(),
'%revision' => $this->revision
->getRevisionId(),
]);
\Drupal::messenger()
->addMessage(t('Answer %title has been reverted.', [
'%title' => $this->revision
->label(),
]));
$form_state
->setRedirect('entity.opigno_activity.version_history', [
'opigno_activity' => $this->revision
->id(),
]);
}