function HistoryController::getNodeReadTimestamps

Same name in other branches
  1. 8.9.x core/modules/history/src/Controller/HistoryController.php \Drupal\history\Controller\HistoryController::getNodeReadTimestamps()
  2. 10 core/modules/history/src/Controller/HistoryController.php \Drupal\history\Controller\HistoryController::getNodeReadTimestamps()
  3. 11.x 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\Controller

Code

public function getNodeReadTimestamps(Request $request) {
    if ($this->currentUser()
        ->isAnonymous()) {
        throw new AccessDeniedHttpException();
    }
    $nids = $request->request
        ->get('node_ids');
    if (!isset($nids)) {
        throw new NotFoundHttpException();
    }
    return new JsonResponse(history_read_multiple($nids));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.