You are here

protected function GroupContentMenuRouteProvider::getEditFormRoute in Group Content Menu 8

Gets the edit-form route.

Parameters

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

Return value

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

Overrides DefaultHtmlRouteProvider::getEditFormRoute

File

src/Routing/GroupContentMenuRouteProvider.php, line 170

Class

GroupContentMenuRouteProvider
Provides routes for group_content_menu content.

Namespace

Drupal\group_content_menu\Routing

Code

protected function getEditFormRoute(EntityTypeInterface $entity_type) {
  if ($route = parent::getEditFormRoute($entity_type)) {
    $requirements = $route
      ->getRequirements();
    unset($requirements['_entity_access']);
    $route
      ->setRequirements($requirements);
    return $route
      ->setRequirement('_group_menu_owns_content', 'TRUE')
      ->setRequirement('_group_permission', 'manage group_content_menu')
      ->setOption('_group_operation_route', TRUE)
      ->setOption('parameters', [
      'group' => [
        'type' => 'entity:group',
      ],
      'group_content_menu' => [
        'type' => 'entity:group_content_menu',
      ],
    ]);
  }
}