function NodeRevisionRevertForm::prepareRevertedRevision

Same name in other branches
  1. 9 core/modules/node/src/Form/NodeRevisionRevertForm.php \Drupal\node\Form\NodeRevisionRevertForm::prepareRevertedRevision()
  2. 8.9.x core/modules/node/src/Form/NodeRevisionRevertForm.php \Drupal\node\Form\NodeRevisionRevertForm::prepareRevertedRevision()
  3. 10 core/modules/node/src/Form/NodeRevisionRevertForm.php \Drupal\node\Form\NodeRevisionRevertForm::prepareRevertedRevision()

Prepares a revision to be reverted.

Parameters

\Drupal\node\NodeInterface $revision: The revision to be reverted.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

\Drupal\node\NodeInterface The prepared revision ready to be stored.

1 call to NodeRevisionRevertForm::prepareRevertedRevision()
NodeRevisionRevertForm::submitForm in core/modules/node/src/Form/NodeRevisionRevertForm.php
Form submission handler.
1 method overrides NodeRevisionRevertForm::prepareRevertedRevision()
NodeRevisionRevertTranslationForm::prepareRevertedRevision in core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php
Prepares a revision to be reverted.

File

core/modules/node/src/Form/NodeRevisionRevertForm.php, line 160

Class

NodeRevisionRevertForm
Provides a form for reverting a node revision.

Namespace

Drupal\node\Form

Code

protected function prepareRevertedRevision(NodeInterface $revision, FormStateInterface $form_state) {
    $revision->setNewRevision();
    $revision->isDefaultRevision(TRUE);
    return $revision;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.