You are here

protected function FormModesSubscriber::alterRoutes in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 src/Routing/EventSubscriber/FormModesSubscriber.php \Drupal\form_mode_manager\Routing\EventSubscriber\FormModesSubscriber::alterRoutes()

Alters existing routes for a specific collection.

Parameters

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

Overrides RouteSubscriberBase::alterRoutes

1 method overrides FormModesSubscriber::alterRoutes()
UserFormModesSubscriber::alterRoutes in src/Routing/EventSubscriber/UserFormModesSubscriber.php
Alters existing routes for a specific collection.

File

src/Routing/EventSubscriber/FormModesSubscriber.php, line 87

Class

FormModesSubscriber
Subscriber for form_mode_manager routes.

Namespace

Drupal\form_mode_manager\Routing\EventSubscriber

Code

protected function alterRoutes(RouteCollection $collection) {
  $form_modes_definitions = $this->formModeManager
    ->getAllFormModesDefinitions();
  unset($form_modes_definitions['user']);
  foreach ($form_modes_definitions as $entity_type_id => $form_modes) {
    $entity_type = $this->entityTypeManager
      ->getDefinition($entity_type_id);
    $this
      ->addFormModesRoutes($collection, $entity_type, $form_modes);
  }
}