annotate core/modules/tracker/src/Plugin/Menu/UserTrackerTab.php @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\tracker\Plugin\Menu;
Chris@0 4
Chris@0 5 use Drupal\Core\Menu\LocalTaskDefault;
Chris@0 6 use Drupal\Core\Routing\RouteMatchInterface;
Chris@0 7
Chris@0 8 /**
Chris@0 9 * Provides route parameters needed to link to the current user tracker tab.
Chris@0 10 */
Chris@0 11 class UserTrackerTab extends LocalTaskDefault {
Chris@0 12
Chris@0 13 /**
Chris@0 14 * Current user object.
Chris@0 15 *
Chris@0 16 * @var \Drupal\Core\Session\AccountInterface
Chris@0 17 */
Chris@0 18 protected $currentUser;
Chris@0 19
Chris@0 20 /**
Chris@0 21 * Gets the current active user.
Chris@0 22 *
Chris@0 23 * @todo: https://www.drupal.org/node/2105123 put this method in
Chris@0 24 * \Drupal\Core\Plugin\PluginBase instead.
Chris@0 25 *
Chris@0 26 * @return \Drupal\Core\Session\AccountInterface
Chris@0 27 */
Chris@0 28 protected function currentUser() {
Chris@0 29 if (!$this->currentUser) {
Chris@0 30 $this->currentUser = \Drupal::currentUser();
Chris@0 31 }
Chris@0 32 return $this->currentUser;
Chris@0 33 }
Chris@0 34
Chris@0 35
Chris@0 36 /**
Chris@0 37 * {@inheritdoc}
Chris@0 38 */
Chris@0 39 public function getRouteParameters(RouteMatchInterface $route_match) {
Chris@0 40 return ['user' => $this->currentUser()->Id()];
Chris@0 41 }
Chris@0 42
Chris@0 43 }