As you know drupal has a function " node_type_get_types " that we can use to get the type of the node, so is there also a function that we can use to get the nid of the current node that we are viewing?
it's just a property of the
Node itself, the
nid of the node. It is the value
There is also entity_extract_ids() which is 1 level up from a
Node in the object hierarchy and this function interacts with
Entities -- if you're trying to do something more generic than merely interact with solely
Nodes ... such as a process a
Entity objects all of different types but sharing a
field you want set with a certain value.
Helper function to extract id, vid, and bundle name from an entity.
$entity_type: The entity type; e.g. 'node' or 'user'.
$entity: The entity from which to extract values.
A numerically indexed array (not a hash table) containing these elements:
0: Primary ID of the entity.
1: Revision ID of the entity, or NULL if $entity_type is not versioned.
2: Bundle name of the entity, or NULL if $entity_type has no bundles.