RouteSubscriber.php in Total Control Admin Dashboard 8.2
File
src/Routing/RouteSubscriber.php
View source
<?php
namespace Drupal\total_control\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
use Drupal\Core\Routing\RoutingEvents;
class RouteSubscriber extends RouteSubscriberBase {
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection
->get('page_manager.page_view_total_control_dashboard_total_control_dashboard-http_status_code-0')) {
$route
->setRequirement('_permission', 'have total control');
}
}
public static function getSubscribedEvents() {
$events[RoutingEvents::ALTER][] = [
'onAlterRoutes',
-170,
];
return $events;
}
}