You are here

public function HeartbeatRouteController::getRoutes in Heartbeat 8

Getroutes.

Return value

string Return Hello string.

1 string reference to 'HeartbeatRouteController::getRoutes'
heartbeat.routing.yml in ./heartbeat.routing.yml
heartbeat.routing.yml

File

src/Routing/HeartbeatRouteController.php, line 75

Class

HeartbeatRouteController
Class HeartbeatRouteController.

Namespace

Drupal\heartbeat\Routing

Code

public function getRoutes() {
  $routeCollection = new RouteCollection();
  foreach ($this->heartbeatStreamService
    ->getAllStreams() as $heartbeatStream) {
    $route = new Route($heartbeatStream
      ->getPath()
      ->getValue()[0]['value'], array(
      '_controller' => '\\Drupal\\heartbeat\\Controller\\HeartbeatStreamController::createRoute',
      '_title' => $heartbeatStream
        ->getName(),
      'heartbeatStreamId' => $heartbeatStream
        ->id(),
    ), array(
      '_permission' => 'access content',
    ));

    // Add the route under the name 'example.content'.
    $routeCollection
      ->add('heartbeat.' . $heartbeatStream
      ->getName(), $route);
  }
  \Drupal::logger('HeartbeatRouteController')
    ->debug('Data is %data', array(
    '%data' => $routeCollection,
  ));
  return $routeCollection;
}