sgd_dashboard-1.0.0-beta1/src/Routing/RouteSubscriber.php
src/Routing/RouteSubscriber.php
<?php
namespace Drupal\sgd_dashboard\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
/**
* Listens to the dynamic route events.
*/
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
public function alterRoutes(RouteCollection $collection) {
// Alter the canonical node route to our custom route.
if ($route = $collection->get('entity.node.canonical')) {
$route->setDefault('_controller', '\Drupal\sgd_dashboard\Controller\SgdWebsiteViewController::view');
}
}
}
