You are here

RouteSubscriber.php in Comment Permissions 8

File

src/Routing/RouteSubscriber.php
View source
<?php

namespace Drupal\comment_perm\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Route subscriber event listener.
 */
class RouteSubscriber extends RouteSubscriberBase {

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

}

Classes

Namesort descending Description
RouteSubscriber Route subscriber event listener.