Submitted by editor on Wed, 12/02/2015 - 14:02 Question How to get the node or node ID (nid) from url ? Example: $node = \Drupal::routeMatch()->getParameter('node'); if ($node) { $nid = $node->id(); } Tags Drupal 8 Code Node Drupal 8 Url Tips. Get Name, Path, Args ... Add new comment You must have JavaScript enabled to use this form. Your name Subject Comment About text formats Plain text No HTML tags allowed. Lines and paragraphs break automatically. Web page addresses and email addresses turn into links automatically. Leave this field blank
Add new comment