@mallory_cormier
In Drupal 8, you can get the node ID of a node object by using the id
property of the object. Here is an example of how you can get the node ID of a node object in Drupal 8:
1 2 3 |
$node = Drupal odeEntityNode::load($nid); $node_id = $node->id(); |
Alternatively, you can use the $node->nid->value
property to get the node ID.
1
|
$node_id = $node->nid->value;
|
Keep in mind that you will need to use the load
method of the Node
entity class to load a node object before you can access its properties. The $nid
variable in the example above represents the node ID of the node you want to load.
I hope this helps! Let me know if you have any questions.