public function OrderRouteProvider::getRoutes in Ubercart 8.4
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
- uc_order/
src/ Entity/ OrderRouteProvider.php, line 18
Class
- OrderRouteProvider
- Provides routes for uc_orders.
Namespace
Drupal\uc_order\EntityCode
public function getRoutes(EntityTypeInterface $entity_type) {
$route_collection = new RouteCollection();
$route = (new Route('/admin/store/orders/{uc_order}'))
->addDefaults([
'_entity_view' => 'uc_order.view',
'_title_callback' => '\\Drupal\\uc_order\\Controller\\OrderController::pageTitle',
])
->setRequirement('uc_order', '\\d+')
->setRequirement('_permission', 'view all orders');
$route_collection
->add('entity.uc_order.canonical', $route);
$route = (new Route('/admin/store/orders/{uc_order}/delete'))
->addDefaults([
'_entity_form' => 'uc_order.delete',
'_title' => 'Delete',
])
->setRequirement('uc_order', '\\d+')
->setRequirement('_entity_access', 'uc_order.delete');
$route_collection
->add('entity.uc_order.delete_form', $route);
$route = (new Route('/admin/store/orders/{uc_order}/edit'))
->setDefaults([
'_entity_form' => 'uc_order.edit',
'_title_callback' => '\\Drupal\\uc_order\\Controller\\OrderController::pageTitle',
])
->setRequirement('_permission', 'edit orders')
->setRequirement('uc_order', '\\d+');
$route_collection
->add('entity.uc_order.edit_form', $route);
return $route_collection;
}