You are here

public function GroupContentMenuRouteProvider::getRoutes in Group Content Menu 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 DefaultHtmlRouteProvider::getRoutes

File

src/Routing/GroupContentMenuRouteProvider.php, line 19

Class

GroupContentMenuRouteProvider
Provides routes for group_content_menu content.

Namespace

Drupal\group_content_menu\Routing

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = parent::getRoutes($entity_type);
  if ($add_menu_link = $this
    ->getAddMenuLink($entity_type)) {
    $collection
      ->add('entity.group_content_menu.add_link', $add_menu_link);
  }
  if ($add_menu_link = $this
    ->getEditMenuLink($entity_type)) {
    $collection
      ->add('entity.group_content_menu.edit_link', $add_menu_link);
  }
  return $collection;
}