You are here

public function MandrillActivityRoutes::routes in Mandrill 8

1 string reference to 'MandrillActivityRoutes::routes'
mandrill_activity.routing.yml in modules/mandrill_activity/mandrill_activity.routing.yml
modules/mandrill_activity/mandrill_activity.routing.yml

File

modules/mandrill_activity/src/Routing/MandrillActivityRoutes.php, line 23
Contains \Drupal\mandrill_activity\Routing\MandrillActivityRoutes.

Class

MandrillActivityRoutes
Defines dynamic routes for Mandrill Activity entities.

Namespace

Drupal\mandrill_activity\Routing

Code

public function routes() {
  $routes = array();
  $activity_ids = \Drupal::entityQuery('mandrill_activity')
    ->execute();
  $activity_entities = MandrillActivity::loadMultiple($activity_ids);

  /* @var $activity \Drupal\mandrill_activity\Entity\MandrillActivity */
  foreach ($activity_entities as $activity) {
    if (!$activity->enabled) {
      continue;
    }
    $routes['entity.' . $activity->entity_type . '.mandrill_activity'] = new Route($activity->entity_type . '/{' . $activity->entity_type . '}/mandrill_activity', array(
      '_controller' => '\\Drupal\\mandrill_activity\\Controller\\MandrillActivityController::overview',
      '_title' => 'Mandrill Activity',
    ), array(
      '_permission' => 'access mandrill activity',
    ));
  }
  return $routes;
}