You are here

protected function GroupContentMenuRouteProvider::getEditMenuLink in Group Content Menu 8

Gets the edit-menu-link route.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

1 call to GroupContentMenuRouteProvider::getEditMenuLink()
GroupContentMenuRouteProvider::getRoutes in src/Routing/GroupContentMenuRouteProvider.php
Provides routes for entities.

File

src/Routing/GroupContentMenuRouteProvider.php, line 68

Class

GroupContentMenuRouteProvider
Provides routes for group_content_menu content.

Namespace

Drupal\group_content_menu\Routing

Code

protected function getEditMenuLink(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->hasLinkTemplate('edit-menu-link')) {
    $route = new Route($entity_type
      ->getLinkTemplate('edit-menu-link'));
    return $route
      ->setDefaults([
      '_title' => 'Edit menu link',
      '_controller' => sprintf('%s::editLink', GroupContentMenuController::class),
    ])
      ->setRequirement('_group_permission', 'manage group_content_menu')
      ->setRequirement('_group_installed_content', implode('+', $this
      ->getPluginIds()))
      ->setOption('parameters', [
      'group' => [
        'type' => 'entity:group',
      ],
      'group_content_menu' => [
        'type' => 'entity:group_content_menu',
      ],
      'menu_link_content' => [
        'type' => 'entity:menu_link_content',
      ],
    ])
      ->setOption('_group_operation_route', TRUE);
  }
}