RouteSubscriber.php in Answers 8
Namespace
Drupal\answers\RoutingFile
src/Routing/RouteSubscriber.phpView source
<?php
namespace Drupal\answers\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) {
    // Change controller class for "node/add".
    if ($route = $collection
      ->get('node.add_page')) {
      $route
        ->setDefaults([
        '_title' => 'Add content',
        '_controller' => '\\Drupal\\answers\\Controller\\AnswersNodeController::addPage',
      ]);
    }
  }
}Classes
| Name   | Description | 
|---|---|
| RouteSubscriber | Listens to the dynamic route events. | 
