You are here

protected function MediaRevisionRevertForm::prepareRevertedRevision in Media Revisions UI 8

Same name and namespace in other branches
  1. 2.0.x src/Form/MediaRevisionRevertForm.php \Drupal\media_revisions_ui\Form\MediaRevisionRevertForm::prepareRevertedRevision()

Prepares a revision to be reverted.

Parameters

\Drupal\media\MediaInterface $revision: The revision to be reverted.

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

Return value

\Drupal\media\MediaInterface The prepared revision ready to be stored.

1 call to MediaRevisionRevertForm::prepareRevertedRevision()
MediaRevisionRevertForm::submitForm in src/Form/MediaRevisionRevertForm.php
Form submission handler.
1 method overrides MediaRevisionRevertForm::prepareRevertedRevision()
MediaRevisionRevertTranslationForm::prepareRevertedRevision in src/Form/MediaRevisionRevertTranslationForm.php
Prepares a revision to be reverted.

File

src/Form/MediaRevisionRevertForm.php, line 166

Class

MediaRevisionRevertForm
Provides a form for reverting media revision.

Namespace

Drupal\media_revisions_ui\Form

Code

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