public function PhotosRouteProvider::getRoutes in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x src/Entity/PhotosRouteProvider.php \Drupal\photos\Entity\PhotosRouteProvider::getRoutes()
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
- src/
Entity/ PhotosRouteProvider.php, line 18
Class
- PhotosRouteProvider
- Provides routes for photos images.
Namespace
Drupal\photos\EntityCode
public function getRoutes(EntityTypeInterface $entity_type) {
$route_collection = new RouteCollection();
$parameters = [];
$parameters['node'] = [
'type' => 'entity:node',
];
$route = (new Route('/photos/{node}/{photos_image}'))
->addDefaults([
'_controller' => '\\Drupal\\photos\\Controller\\PhotosImageViewController::view',
'_title_callback' => '\\Drupal\\photos\\Controller\\PhotosImageViewController::title',
])
->setRequirement('_entity_access', 'photos_image.view')
->setRequirement('photos_image', '\\d+')
->setRequirement('node', '\\d+')
->setOption('parameters', $parameters);
$route_collection
->add('entity.photos_image.canonical', $route);
$route = (new Route('/photos/{node}/{photos_image}/delete'))
->addDefaults([
'_entity_form' => 'photos_image.delete',
'_title' => 'Delete image',
])
->setRequirement('_entity_access', 'photos_image.delete')
->setRequirement('photos_image', '\\d+')
->setRequirement('node', '\\d+')
->setOption('parameters', $parameters)
->setOption('_photos_image_operation_route', TRUE);
$route_collection
->add('entity.photos_image.delete_form', $route);
$route = (new Route('/photos/{node}/{photos_image}/edit'))
->setDefault('_entity_form', 'photos_image.edit')
->setRequirement('_entity_access', 'photos_image.update')
->setRequirement('photos_image', '\\d+')
->setRequirement('node', '\\d+')
->setOption('parameters', $parameters)
->setOption('_photos_image_operation_route', TRUE);
$route_collection
->add('entity.photos_image.edit_form', $route);
return $route_collection;
}