You are here

class RouteSubscriber in Default Content 8

Subscriber for Devel routes.

Hierarchy

  • class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteSubscriber

File

src/Routing/RouteSubscriber.php, line 19
Contains \Drupal\defaultcontent\Routing\RouteSubscriber.

Namespace

Drupal\defaultcontent\Routing
View source
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    $route = new Route('node/{node}/convert', [
      '_controller' => '\\Drupal\\defaultcontent\\Export::export',
      '_title_callback' => '\\Drupal\\defaultcontent\\Export::title',
    ], [
      '_permission' => 'access devel information',
    ], [
      '_admin_route' => TRUE,
    ]);
    $collection
      ->add("entity.node.convert", $route);
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events = parent::getSubscribedEvents();
    $events[RoutingEvents::ALTER] = 'onAlterRoutes';
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. Overrides RouteSubscriberBase::getSubscribedEvents
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1