3 namespace Drupal\tracker\Plugin\Menu;
5 use Drupal\Core\Menu\LocalTaskDefault;
6 use Drupal\Core\Routing\RouteMatchInterface;
9 * Provides route parameters needed to link to the current user tracker tab.
11 class UserTrackerTab extends LocalTaskDefault {
14 * Current user object.
16 * @var \Drupal\Core\Session\AccountInterface
18 protected $currentUser;
21 * Gets the current active user.
23 * @todo: https://www.drupal.org/node/2105123 put this method in
24 * \Drupal\Core\Plugin\PluginBase instead.
26 * @return \Drupal\Core\Session\AccountInterface
28 protected function currentUser() {
29 if (!$this->currentUser) {
30 $this->currentUser = \Drupal::currentUser();
32 return $this->currentUser;
38 public function getRouteParameters(RouteMatchInterface $route_match) {
39 return ['user' => $this->currentUser()->Id()];