Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 7 |
UserTrackerTab | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 7 |
currentUser | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 5 |
|||
getRouteParameters | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\tracker\Plugin\Menu\UserTrackerTab. | |
*/ | |
namespace Drupal\tracker\Plugin\Menu; | |
use Drupal\Core\Menu\LocalTaskDefault; | |
use Drupal\Core\Routing\RouteMatchInterface; | |
/** | |
* Provides route parameters needed to link to the current user tracker tab. | |
*/ | |
class UserTrackerTab extends LocalTaskDefault { | |
/** | |
* Current user object. | |
* | |
* @var \Drupal\Core\Session\AccountInterface | |
*/ | |
protected $currentUser; | |
/** | |
* Gets the current active user. | |
* | |
* @todo: https://www.drupal.org/node/2105123 put this method in | |
* \Drupal\Core\Plugin\PluginBase instead. | |
* | |
* @return \Drupal\Core\Session\AccountInterface | |
*/ | |
protected function currentUser() { | |
if (!$this->currentUser) { | |
$this->currentUser = \Drupal::currentUser(); | |
} | |
return $this->currentUser; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getRouteParameters(RouteMatchInterface $route_match) { | |
return array('user' => $this->currentUser()->Id()); | |
} | |
} |