protected function GroupContentMenuRouteProvider::getCanonicalRoute in Group Content Menu 8
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/
Routing/ GroupContentMenuRouteProvider.php, line 152
Class
- GroupContentMenuRouteProvider
- Provides routes for group_content_menu content.
Namespace
Drupal\group_content_menu\RoutingCode
protected function getCanonicalRoute(EntityTypeInterface $entity_type) {
if ($route = parent::getCanonicalRoute($entity_type)) {
$requirements = $route
->getRequirements();
unset($requirements['_entity_access']);
$route
->setRequirements($requirements);
return $route
->setRequirement('_group_menu_owns_content', 'TRUE')
->setOption('_group_operation_route', TRUE)
->setOption('parameters', [
'group' => [
'type' => 'entity:group',
],
'group_content_menu' => [
'type' => 'entity:group_content_menu',
],
]);
}
}