function NodeRevisionRevertTranslationForm::prepareRevertedRevision
Same name and namespace in other branches
- 8.9.x core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php \Drupal\node\Form\NodeRevisionRevertTranslationForm::prepareRevertedRevision()
- 10 core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php \Drupal\node\Form\NodeRevisionRevertTranslationForm::prepareRevertedRevision()
- 11.x core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php \Drupal\node\Form\NodeRevisionRevertTranslationForm::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.
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\FormCode
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.