You are here

protected function UserFormModesSubscriber::alterRoutes in Form mode manager 8

Alters existing routes for a specific collection.

Parameters

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

Overrides FormModesSubscriber::alterRoutes

File

src/Routing/EventSubscriber/UserFormModesSubscriber.php, line 21

Class

UserFormModesSubscriber
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();
  $entity_type_id = 'user';
  if (isset($form_modes_definitions[$entity_type_id])) {
    $form_modes = $form_modes_definitions[$entity_type_id];
    $entity_type = $this->entityTypeManager
      ->getDefinition($entity_type_id);
    $this
      ->addFormModesRoutes($collection, $entity_type, $form_modes);
  }
}