You are here

public function EntityFlagActionRouteProvider::getRoutes in farmOS 2.x

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 EntityRouteProviderInterface::getRoutes

File

modules/core/flag/src/Routing/EntityFlagActionRouteProvider.php, line 18

Class

EntityFlagActionRouteProvider
Provides routes for the entity flag action.

Namespace

Drupal\farm_flag\Routing

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = new RouteCollection();
  $entity_type_id = $entity_type
    ->id();
  if ($flag_route = $this
    ->getEntityFlagFormRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.flag_form", $flag_route);
  }
  return $collection;
}