You are here

protected function GroupContentRouteProvider::getCanonicalRoute in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/Routing/GroupContentRouteProvider.php \Drupal\group\Entity\Routing\GroupContentRouteProvider::getCanonicalRoute()

Gets the canonical 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::getCanonicalRoute

File

src/Entity/Routing/GroupContentRouteProvider.php, line 144

Class

GroupContentRouteProvider
Provides routes for group content.

Namespace

Drupal\group\Entity\Routing

Code

protected function getCanonicalRoute(EntityTypeInterface $entity_type) {
  return parent::getCanonicalRoute($entity_type)
    ->setRequirement('_group_owns_content', 'TRUE')
    ->setOption('parameters', [
    'group' => [
      'type' => 'entity:group',
    ],
    'group_content' => [
      'type' => 'entity:group_content',
    ],
  ]);
}