You are here

public function FileRouteProvider::getRoutes in Panopoly 8.2

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/panopoly/panopoly_media/src/Routing/FileRouteProvider.php, line 18

Class

FileRouteProvider
Provides routes for files.

Namespace

Drupal\panopoly_media\Routing

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $route_collection = new RouteCollection();

  // Individual file delete form.
  $route = (new Route('/file/{file}/delete'))
    ->addDefaults([
    '_entity_form' => 'file.delete',
    '_title' => 'Delete',
  ])
    ->setRequirement('file', '\\d+')
    ->setRequirement('_entity_access', 'file.delete');
  $route_collection
    ->add('entity.file.delete_form', $route);

  // Bulk operation confirmation form.
  $route = (new Route('/admin/content/files/delete'))
    ->addDefaults([
    '_form' => '\\Drupal\\panopoly_media\\Form\\FileDeleteMultiple',
  ])
    ->setRequirement('_permission', 'access files overview');
  $route_collection
    ->add('file.multiple_delete_confirm', $route);
  return $route_collection;
}