drupal 8 get route parameters code example
Example 1: drupal 8 routing parameters
example.user:
path: '/example/{user}'
defaults:
_controller: '\Drupal\example\Controller\ExampleController::content'
requirements:
_permission: 'access content'
options:
parameters:
user:
type: entity:user
Example 2: drupal8 get params from route
if ($node = \Drupal::routeMatch()->getParameter('node')) {
}