public function UserController::revisionShow in User Revision 8
Displays a user revision.
Parameters
int $user: The user ID.
int $user_revision: The user revision ID.
Return value
array An array suitable for drupal_render().
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
1 string reference to 'UserController::revisionShow'
File
- src/
Controller/ UserController.php, line 187
Class
- UserController
- Returns responses for User revision routes.
Namespace
Drupal\user_revision\ControllerCode
public function revisionShow($user, $user_revision) {
$user_history = $this->entityTypeManager
->getStorage('user')
->loadRevision($user_revision);
if ($user_history
->id() != $user) {
throw new NotFoundHttpException();
}
/* @var $view_builder \Drupal\Core\Entity\EntityViewBuilder */
$view_builder = $this->entityTypeManager
->getViewBuilder($user_history
->getEntityTypeId());
return $view_builder
->view($user_history);
}