dbb-1.0.x-dev/src/Routing/RouteSubscriber.php
src/Routing/RouteSubscriber.php
<?php
namespace Drupal\dbb\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\dbb\Controller\NodeRedirectController::view');
}
}
}
