Last active
May 5, 2018 21:38
-
-
Save init90/05d79583d83c0ef0bfa774e4538a555b to your computer and use it in GitHub Desktop.
Drupal 8, get route name by url.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = 'url'; | |
$url_object = \Drupal::service('path.validator')->getUrlIfValid($url); | |
$route = $url_object->getRouteName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment