Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

drupal 9 get nid from node

$node = Drupal::routeMatch()->getParameter('node');
if ($node instanceof Drupal
odeNodeInterface) {
  // You can get nid and anything else you need from the node object.
  $nid = $node->id();
}
Source by drupal.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #drupal #nid #node
ADD COMMENT
Topic
Name
5+9 =