public function OgAdminRoutesEvent::getRoutes in Organic groups 8
Get routes.
Parameters
string $entity_type_id: The entity type ID.
Return value
array Array with the routes info.
Overrides OgAdminRoutesEventInterface::getRoutes
File
- src/
Event/ OgAdminRoutesEvent.php, line 39
Class
- OgAdminRoutesEvent
- Event that is fired when OG admin routes are being compiled.
Namespace
Drupal\og\EventCode
public function getRoutes($entity_type_id) {
$routes_info = [];
foreach ($this->routesInfo as $name => $route_info) {
$routes_info[$name] = $route_info;
// Add default values.
$routes_info[$name] += [
'description' => '',
'requirements' => [
'_og_user_access_group' => OgAccess::ADMINISTER_GROUP_PERMISSION,
],
'options' => [
'parameters' => [
$entity_type_id => [
'type' => 'entity:' . $entity_type_id,
],
],
// The above parameters doesn't send the entity,
// so we will have to use the Route matcher to extract it.
'_og_entity_type_id' => $entity_type_id,
'_admin_route' => TRUE,
],
// Move the title and controller under the "defaults" key.
'defaults' => [
'_controller' => $route_info['controller'],
'_title' => $route_info['title'],
],
];
}
return $routes_info;
}