MandrillActivityRoutes.php in Mandrill 8
File
modules/mandrill_activity/src/Routing/MandrillActivityRoutes.php
View source
<?php
namespace Drupal\mandrill_activity\Routing;
use Drupal\mandrill_activity\Entity\MandrillActivity;
use Symfony\Component\Routing\Route;
class MandrillActivityRoutes {
public function routes() {
$routes = array();
$activity_ids = \Drupal::entityQuery('mandrill_activity')
->execute();
$activity_entities = MandrillActivity::loadMultiple($activity_ids);
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;
}
}