You are here

protected function HeartbeatRouteSubscriber::alterRoutes in Heartbeat 8

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/HeartbeatRouteSubscriber.php, line 24

Class

HeartbeatRouteSubscriber

Namespace

Drupal\heartbeat\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  if ($collection) {
    if ($thisroute = $collection
      ->get('heartbeat.update_feed')) {
      $path = $thisroute
        ->getPath();
    }
  }
  if ($route = $collection
    ->get('heartbeat.user_edit')) {
    if ($route !== null) {
      $route
        ->setPath('/user/' . \Drupal::currentUser()
        ->id() . '/edit');
    }
  }
}