You are here

final class TeamAppDevelRouteFixerSubscriber in Apigee Edge 8

Fixes the entity routes generated by the Devel module.

TeamAppByNameRouteAlterSubscriber adds another changes if needed.

Hierarchy

Expanded class hierarchy of TeamAppDevelRouteFixerSubscriber

See also

apigee_edge_teams_entity_type_alter()

\Drupal\apigee_edge_teams\Routing\TeamAppByNameRouteAlterSubscriber

1 string reference to 'TeamAppDevelRouteFixerSubscriber'
apigee_edge_teams.services.yml in modules/apigee_edge_teams/apigee_edge_teams.services.yml
modules/apigee_edge_teams/apigee_edge_teams.services.yml
1 service uses TeamAppDevelRouteFixerSubscriber
route_subscriber.apigee_edge_teams.team_app_devel_route_fixer in modules/apigee_edge_teams/apigee_edge_teams.services.yml
Drupal\apigee_edge_teams\Routing\TeamAppDevelRouteFixerSubscriber

File

modules/apigee_edge_teams/src/Routing/TeamAppDevelRouteFixerSubscriber.php, line 35

Namespace

Drupal\apigee_edge_teams\Routing
View source
final class TeamAppDevelRouteFixerSubscriber extends RouteSubscriberBase {

  /**
   * The module handler service.
   *
   * @var \Drupal\Core\Extension\ModuleHandlerInterface
   */
  private $moduleHandler;

  /**
   * TeamAppDevelRouteFixerSubscriber constructor.
   *
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler service.
   */
  public function __construct(ModuleHandlerInterface $module_handler) {
    $this->moduleHandler = $module_handler;
  }

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($this->moduleHandler
      ->moduleExists('devel')) {
      foreach ($collection as $id => $route) {
        if (strpos($id, 'entity.team_app.devel') === 0) {
          $route
            ->setOption('_devel_entity_type_id', 'app');
        }
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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
TeamAppDevelRouteFixerSubscriber::$moduleHandler private property The module handler service.
TeamAppDevelRouteFixerSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
TeamAppDevelRouteFixerSubscriber::__construct public function TeamAppDevelRouteFixerSubscriber constructor.