You are here

class RouteSubscriber in Taxonomy access fix 8

Hierarchy

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

Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber'
taxonomy_access_fix.services.yml in ./taxonomy_access_fix.services.yml
taxonomy_access_fix.services.yml
1 service uses RouteSubscriber
taxonomy_access_fix.route_subscriber in ./taxonomy_access_fix.services.yml
Drupal\taxonomy_access_fix\Routing\RouteSubscriber

File

src/Routing/RouteSubscriber.php, line 8

Namespace

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

  /**
   * New and improved hook_menu_alter().
   */
  public function alterRoutes(RouteCollection $collection) {

    // admin/structure/taxonomy
    if ($route = $collection
      ->get('entity.taxonomy_vocabulary.collection')) {
      $route
        ->setRequirements([
        '_custom_access' => '\\taxonomy_access_fix_route_access',
      ]);
      $route
        ->setOption('op', 'index');
    }

    // admin/structure/taxonomy/%vocabulary
    if ($route = $collection
      ->get('entity.taxonomy_vocabulary.overview_form')) {
      $route
        ->setRequirements([
        '_custom_access' => '\\taxonomy_access_fix_route_access',
      ]);
      $route
        ->setOption('op', 'list terms');
    }

    // admin/structure/taxonomy/%vocabulary/add
    if ($route = $collection
      ->get('entity.taxonomy_term.add_form')) {
      $route
        ->setRequirements([
        '_custom_access' => '\\taxonomy_access_fix_route_access',
      ]);
      $route
        ->setOption('op', 'add terms');
    }

    // admin/structure/taxonomy/manage/%vocabulary/reset
    if ($route = $collection
      ->get('entity.taxonomy_vocabulary.reset_form')) {
      $route
        ->setRequirements([
        '_custom_access' => '\\taxonomy_access_fix_route_access',
      ]);
      $route
        ->setOption('op', 'reorder terms');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes public function New and improved hook_menu_alter(). Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1