Answers for "drupal 9 get nid from node"

0

drupal 9 get nid from node

$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();
}
Posted by: Guest on July-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language