Blog IT

Short snippet that shows how to get url parameters in drupal . to get query parameter form the url, you can us the following.

If you have the url for example /path?id=x

To get "id" from the url, use:

$id= \Drupal::request()->query->get('id');