Skip to main content

Drupal 8: Get machine name of a node in template_preprocess_node()

  1. /**
  2.  * Implements template_preprocess_node().
  3.  */
  4. function THEME_preprocess_node(&$variables) {
  5.   // Return the machine name of the node.
  6.   $variables['node']->bundle();
  7. }


Comments