Skip to content

Instantly share code, notes, and snippets.

@steffenr
Last active July 1, 2017 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steffenr/868e32dcc0bce269eca8 to your computer and use it in GitHub Desktop.
Save steffenr/868e32dcc0bce269eca8 to your computer and use it in GitHub Desktop.
Get current route name based on request in drupal 8.
<?php
$route_name = \Drupal::service('current_route_match')->getRouteName();
?>
@quartarian
Copy link

Thanks!

@bighappyface
Copy link

Also devel has a menu option "Current route info" that provides that exposes the full route configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment