drupal 8 get route in custom module code example Example: drupal 8 get route name $route_name = \Drupal::routeMatch()->getRouteName();