AdminRouteSubscriber.php in Zircon Profile 8.0
File
core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php
View source
<?php
namespace Drupal\system\EventSubscriber;
use Drupal\Core\Routing\RouteSubscriberBase;
use Drupal\Core\Routing\RoutingEvents;
use Symfony\Component\Routing\RouteCollection;
class AdminRouteSubscriber extends RouteSubscriberBase {
protected function alterRoutes(RouteCollection $collection) {
foreach ($collection
->all() as $route) {
if (strpos($route
->getPath(), '/admin') === 0 && !$route
->hasOption('_admin_route')) {
$route
->setOption('_admin_route', TRUE);
}
}
}
public static function getSubscribedEvents() {
$events = parent::getSubscribedEvents();
$events[RoutingEvents::ALTER] = array(
'onAlterRoutes',
-200,
);
return $events;
}
}