You are here

public function SupportTicketRouteProvider::getRoutes in Support Ticketing System 8

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/support_ticket/src/Entity/SupportTicketRouteProvider.php, line 23
Contains \Drupal\support_ticket\Entity\SupportTicketRouteProvider.

Class

SupportTicketRouteProvider
Provides routes for support tickets.

Namespace

Drupal\support_ticket\Entity

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $route_collection = new RouteCollection();
  $route = (new Route('/support_ticket/{support_ticket}'))
    ->addDefaults([
    '_controller' => '\\Drupal\\support_ticket\\Controller\\SupportTicketViewController::view',
    '_title_callback' => '\\Drupal\\support_ticket\\Controller\\SupportTicketViewController::title',
  ])
    ->setRequirement('_entity_access', 'support_ticket.view');
  $route_collection
    ->add('entity.support_ticket.canonical', $route);
  $route = (new Route('/support_ticket/{support_ticket}/delete'))
    ->addDefaults([
    '_entity_form' => 'support_ticket.delete',
    '_title' => 'Delete',
  ])
    ->setRequirement('_entity_access', 'support_ticket.delete')
    ->setOption('_support_ticket_operation_route', TRUE);
  $route_collection
    ->add('entity.support_ticket.delete_form', $route);
  $route = (new Route('/support_ticket/{support_ticket}/edit'))
    ->setDefault('_entity_form', 'support_ticket.edit')
    ->setRequirement('_entity_access', 'support_ticket.update')
    ->setOption('_support_ticket_operation_route', TRUE);
  $route_collection
    ->add('entity.support_ticket.edit_form', $route);
  return $route_collection;
}