public function HistoryController::readNode in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/history/src/Controller/HistoryController.php \Drupal\history\Controller\HistoryController::readNode()
Marks a node as read by the current user right now.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request of the page.
\Drupal\node\NodeInterface $node: The node whose "last read" timestamp should be updated.
1 string reference to 'HistoryController::readNode'
- 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 51 - Contains \Drupal\history\Controller\HistoryController.
Class
- HistoryController
- Returns responses for History module routes.
Namespace
Drupal\history\ControllerCode
public function readNode(Request $request, NodeInterface $node) {
if ($this
->currentUser()
->isAnonymous()) {
throw new AccessDeniedHttpException();
}
// Update the history table, stating that this user viewed this node.
history_write($node
->id());
return new JsonResponse((int) history_read($node
->id()));
}