New answers tagged

4

You will need to check if the $node variable is actually an instance of node object. if ($node instanceof \Drupal\node\NodeInterface) { // You can get nid and anything else you need from the node object. $nid = $node->id(); } See How do I get the current node ID?


Top 50 recent answers are included