Load an object from the current request
Saturday, October 27, 2018 - 22:49
This is formerly known as menu_get_object().
Load a node from the request
$node = \Drupal::request()->attributes->get('node');
dump($node);
// Returns null or a node object.
Load a user from the request
$user = \Drupal::request()->attributes->get('user');
dump($user);
// Returns null or a user object.