You are here

public function EntityExportCsvHtmlRouteProvider::getRoutes in Entity Export CSV 8

Provides routes for entities.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type

Return value

\Symfony\Component\Routing\RouteCollection|\Symfony\Component\Routing\Route[] Returns a route collection or an array of routes keyed by name, like route_callbacks inside 'routing.yml' files.

Overrides DefaultHtmlRouteProvider::getRoutes

File

src/EntityExportCsvHtmlRouteProvider.php, line 20

Class

EntityExportCsvHtmlRouteProvider
Provides routes for Entity export csv entities.

Namespace

Drupal\entity_export_csv

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = parent::getRoutes($entity_type);
  $entity_type_id = $entity_type
    ->id();
  if ($enable_form_route = $this
    ->getFormRoute($entity_type, 'enable')) {
    $collection
      ->add("entity.{$entity_type_id}.enable", $enable_form_route);
  }
  if ($disable_form_route = $this
    ->getFormRoute($entity_type, 'disable')) {
    $collection
      ->add("entity.{$entity_type_id}.disable", $disable_form_route);
  }
  if ($duplicate_form_route = $this
    ->getFormRoute($entity_type, 'duplicate')) {
    $collection
      ->add("entity.{$entity_type_id}.duplicate", $duplicate_form_route);
  }
  return $collection;
}