You are here

public function RouteSubscriber::alterRoutes in Comment Permissions 8

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/RouteSubscriber.php, line 16

Class

RouteSubscriber
Route subscriber event listener.

Namespace

Drupal\comment_perm\Routing

Code

public function alterRoutes(RouteCollection $collection) {
  if ($route = $collection
    ->get('comment.reply')) {
    $route
      ->setRequirement('_custom_access', '\\Drupal\\comment_perm\\Access\\CommentAccess::replyFormAccess');
  }
}