public HistoryController::readNode(Request $request, NodeInterface $node)
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.
File
- core/modules/history/src/Controller/HistoryController.php, line 46
Class
- HistoryController
- Returns responses for History module routes.
Namespace
Drupal\history\Controller
Code
1 2 3 4 5 6 7 8 9 10 | 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())); } |
Please login to continue.