Skip to content

Commit c9c174d

Browse files
committed
get entity_type_id from route
1 parent b8a2599 commit c9c174d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Controller/OgAdminRoutesController.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@ public static function create(ContainerInterface $container) {
5555
* List of available admin routes for the current group.
5656
*/
5757
public function overview(RouteMatchInterface $route_match) {
58+
$entity_type_id = $route_match->getRouteObject()->getOption('_og_entiy_type_id');
5859
/** @var \Drupal\Core\Entity\EntityInterface $group */
59-
$group = $route_match->getParameter('group');
60-
if (!is_object($group)) {
61-
return;
62-
}
60+
$group = $route_match->getParameter($entity_type_id ?: 'group');
61+
6362
// Get list from routes.
6463
$content = [];
6564

6665
$route_name = "og_admin.members";
67-
$parameters = ['entity_type_id' => $group->getEntityTypeId(), 'group' => $group->id()];
66+
$parameters = ['entity_type_id' => $group->getEntityTypeId() ?: $entity_type_id, 'group' => $group->id()];
6867

6968
// We don't use Url::fromRoute() here for the access check, as it will
7069
// prevent us from unit testing this method.

0 commit comments

Comments
 (0)