Created
October 18, 2018 15:17
-
-
Save GoZOo/6e484f4e3001242a91922a63cc4195cd to your computer and use it in GitHub Desktop.
Drupal 8 - Get route name and parameters from 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
// Launch this thanks to /devel/php in your development environment. | |
$current_path = '/admin/config/'; | |
$url_object = \Drupal::service('path.validator')->getUrlIfValid($current_path); | |
$route_name = $url_object->getRouteName(); | |
$route_parameters = $url_object->getrouteParameters(); | |
dpm($route_name); | |
dpm($route_parameters); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment