public function HistoryController::getNodeReadTimestamps in Drupal 10
Same name and namespace in other branches
- 8 core/modules/history/src/Controller/HistoryController.php \Drupal\history\Controller\HistoryController::getNodeReadTimestamps()
- 9 core/modules/history/src/Controller/HistoryController.php \Drupal\history\Controller\HistoryController::getNodeReadTimestamps()
Returns a set of nodes' last read timestamps.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request of the page.
Return value
Symfony\Component\HttpFoundation\JsonResponse The JSON response.
1 string reference to 'HistoryController::getNodeReadTimestamps'
- history.routing.yml in core/modules/ history/ history.routing.yml 
- core/modules/history/history.routing.yml
File
- core/modules/ history/ src/ Controller/ HistoryController.php, line 26 
Class
- HistoryController
- Returns responses for History module routes.
Namespace
Drupal\history\ControllerCode
public function getNodeReadTimestamps(Request $request) {
  if ($this
    ->currentUser()
    ->isAnonymous()) {
    throw new AccessDeniedHttpException();
  }
  if (!$request->request
    ->has('node_ids')) {
    throw new NotFoundHttpException();
  }
  $nids = $request->request
    ->all('node_ids');
  return new JsonResponse(history_read_multiple($nids));
}