You are here

public function ActivityRevisionsController::previewActivityRevision in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/Controller/ActivityRevisionsController.php \Drupal\opigno_module\Controller\ActivityRevisionsController::previewActivityRevision()

Preview activity revision.

File

src/Controller/ActivityRevisionsController.php, line 27

Class

ActivityRevisionsController
Class OpignoAnswerController.

Namespace

Drupal\opigno_module\Controller

Code

public function previewActivityRevision($opigno_activity, $opigno_activity_revision) {
  $vids = $opigno_activity
    ->revisionIds();
  if (!in_array($opigno_activity_revision, $vids)) {
    throw new NotFoundHttpException();
  }
  $activity = $this
    ->entityTypeManager()
    ->getStorage('opigno_activity')
    ->loadRevision($opigno_activity_revision);
  $page = \Drupal::entityTypeManager()
    ->getViewBuilder('opigno_activity')
    ->view($activity, 'activity');
  return $page;
}