You are here

protected function RouteSubscriber::alterRoutes in Pardot Integration 2.x

Alters existing routes for a specific collection.

Parameters

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

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/RouteSubscriber.php, line 40

Class

RouteSubscriber
Subscriber for Devel routes.

Namespace

Drupal\pardot\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if ($entity_type_id === 'contact_form' || $entity_type_id === 'webform') {
      if ($route = $this
        ->getFormRoute($entity_type)) {
        $collection
          ->add("entity.{$entity_type_id}.pardot_form_mapping", $route);
      }
    }
  }
  return $collection;
}