From time to time you just need the node ID of the current node to get things done. In Drupal 7 you simply used the arg() function to do this, this approach no longer works for Drupal 8 and onwards because arg() is deprecated.https://www.thesavvyfew.com/insights/accessing-current-node-id-drupal