HistoryController::getNodeReadTimestamps

public HistoryController::getNodeReadTimestamps(Request $request)

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.

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));
}
doc_Drupal
2016-10-29 09:17:42
Comments
Leave a Comment

Please login to continue.