For Drupal 8 / 9 and 10, finding the node from the route is done with the following code.
$node = \Drupal::routeMatch()->getParameter('node');
if ($node instanceof \Drupal\node\NodeInterface) {
// $node
}
For Drupal 8 / 9 and 10, finding the node from the route is done with the following code.
$node = \Drupal::routeMatch()->getParameter('node');
if ($node instanceof \Drupal\node\NodeInterface) {
// $node
}
Add new comment