function NodeRevisionRevertTranslationForm::prepareRevertedRevision

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

Overrides NodeRevisionRevertForm::prepareRevertedRevision

File

core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php, line 108

Class

NodeRevisionRevertTranslationForm
Provides a form for reverting a node revision for a single translation.

Namespace

Drupal\node\Form

Code

protected function prepareRevertedRevision(NodeInterface $revision, FormStateInterface $form_state) {
    $revert_untranslated_fields = (bool) $form_state->getValue('revert_untranslated_fields');
    $translation = $revision->getTranslation($this->langcode);
    return $this->nodeStorage
        ->createRevision($translation, TRUE, $revert_untranslated_fields);
}

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