blob: ce41d7d451ec02df8c305ddcfc7a8b1d3d0e2a11 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
namespace Drupal\file\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\EntityRouteProviderInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* Provides routes for files.
*/
class FileRouteProvider implements EntityRouteProviderInterface {
/**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface $entity_type) {
$route_collection = new RouteCollection();
$route = (new Route('/file/{file}/delete'))
->addDefaults([
'_entity_form' => 'file.delete',
'_title' => 'Delete',
])
->setRequirement('file', '\d+')
->setRequirement('_entity_access', 'file.delete')
->setOption('_admin_route', TRUE);
$route_collection->add('entity.file.delete_form', $route);
return $route_collection;
}
}
|