class Route in Open Social 8.9
Same name in this branch
- 8.9 modules/custom/social_gdpr/src/Subscriber/Route.php \Drupal\social_gdpr\Subscriber\Route
- 8.9 modules/social_features/social_group/modules/social_group_flexible_group/src/Subscriber/Route.php \Drupal\social_group_flexible_group\Subscriber\Route
Same name and namespace in other branches
- 8.6 modules/social_features/social_group/modules/social_group_flexible_group/src/Subscriber/Route.php \Drupal\social_group_flexible_group\Subscriber\Route
- 8.7 modules/social_features/social_group/modules/social_group_flexible_group/src/Subscriber/Route.php \Drupal\social_group_flexible_group\Subscriber\Route
- 8.8 modules/social_features/social_group/modules/social_group_flexible_group/src/Subscriber/Route.php \Drupal\social_group_flexible_group\Subscriber\Route
- 10.3.x modules/social_features/social_group/modules/social_group_flexible_group/src/Subscriber/Route.php \Drupal\social_group_flexible_group\Subscriber\Route
- 10.0.x modules/social_features/social_group/modules/social_group_flexible_group/src/Subscriber/Route.php \Drupal\social_group_flexible_group\Subscriber\Route
- 10.1.x modules/social_features/social_group/modules/social_group_flexible_group/src/Subscriber/Route.php \Drupal\social_group_flexible_group\Subscriber\Route
- 10.2.x modules/social_features/social_group/modules/social_group_flexible_group/src/Subscriber/Route.php \Drupal\social_group_flexible_group\Subscriber\Route
Class Route.
@package Drupal\social_group_flexible_group\Subscriber
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\social_group_flexible_group\Subscriber\Route
Expanded class hierarchy of Route
1 string reference to 'Route'
- social_group_flexible_group.services.yml in modules/
social_features/ social_group/ modules/ social_group_flexible_group/ social_group_flexible_group.services.yml - modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.services.yml
1 service uses Route
- social_group_flexible_group_access.route_subscriber in modules/
social_features/ social_group/ modules/ social_group_flexible_group/ social_group_flexible_group.services.yml - Drupal\social_group_flexible_group\Subscriber\Route
File
- modules/
social_features/ social_group/ modules/ social_group_flexible_group/ src/ Subscriber/ Route.php, line 13
Namespace
Drupal\social_group_flexible_group\SubscriberView source
class Route extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
// We define our routes and how they are impacted.
// is it on content visibility or join method.
$join_routes = [
'view.group_manage_members.page_group_manage_members' => 'join direct',
'entity.group_content.add_form' => 'join added',
];
foreach ($join_routes as $name => $argument) {
if ($route = $collection
->get($name)) {
$current = $route
->getRequirements();
$requirements = array_merge($current, [
'_flexible_group_join_permission' => $argument,
]);
$route
->addRequirements($requirements);
}
}
// Based on content visibility some routes need access.
// The argument is there for a minimum content visibility.
$content_routes = [
'entity.group.canonical',
'view.group_information.page_group_about',
'view.group_members.page_group_members',
'social_group.stream',
'view.group_events.page_group_events',
'view.group_topics.page_group_topics',
];
// Invoke implementations of
// hook_social_group_flexible_group_content_routes_alter().
// This to ensure extensions can also add their content tabs.
\Drupal::moduleHandler()
->alter('social_group_flexible_group_content_routes', $content_routes);
foreach ($content_routes as $name) {
if ($route = $collection
->get($name)) {
$current = $route
->getRequirements();
$requirements = array_merge($current, [
'_flexible_group_content_visibility' => 'public',
]);
$route
->addRequirements($requirements);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Route:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |