4 September
Get node id of current node page Drupal 10
Published On: Wed, 09/04/2024 - 12:11
$node = \Drupal::routeMatch()->getParameter('node'); if ($node instanceof \Drupal\node\NodeInterface) { // You can get nid and anything else you need from the node object. $nid = $node->id(); }