How to get path alias and arguments in Drupal 8?
May 09, 2016 - 07:31
In Drupal 7, the function drupal_get_path_alias is used to get the path alias from internal path and arg function is used to get arguments from url. But both these functions are deprecated in Drupal 8.
Drupal 8 uses service container to access various services such as sending an email, accessing a database etc. This ensures that a decoupled nature of the system is respected. We will use the services of current path and path alias to get the result.