class SocialGroupSecretSubscriber in Open Social 8.7
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/modules/social_group_secret/src/EventSubscriber/SocialGroupSecretSubscriber.php \Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
- 8.6 modules/social_features/social_group/modules/social_group_secret/src/EventSubscriber/SocialGroupSecretSubscriber.php \Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
- 8.8 modules/social_features/social_group/modules/social_group_secret/src/EventSubscriber/SocialGroupSecretSubscriber.php \Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
- 10.3.x modules/social_features/social_group/modules/social_group_secret/src/EventSubscriber/SocialGroupSecretSubscriber.php \Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
- 10.0.x modules/social_features/social_group/modules/social_group_secret/src/EventSubscriber/SocialGroupSecretSubscriber.php \Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
- 10.1.x modules/social_features/social_group/modules/social_group_secret/src/EventSubscriber/SocialGroupSecretSubscriber.php \Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
- 10.2.x modules/social_features/social_group/modules/social_group_secret/src/EventSubscriber/SocialGroupSecretSubscriber.php \Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
Class SocialGroupSecretSubscriber.
@package Drupal\social_group_secret\EventSubscriber
Hierarchy
- class \Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
Expanded class hierarchy of SocialGroupSecretSubscriber
1 string reference to 'SocialGroupSecretSubscriber'
- social_group_secret.services.yml in modules/
social_features/ social_group/ modules/ social_group_secret/ social_group_secret.services.yml - modules/social_features/social_group/modules/social_group_secret/social_group_secret.services.yml
1 service uses SocialGroupSecretSubscriber
- social_group_secret.subscriber in modules/
social_features/ social_group/ modules/ social_group_secret/ social_group_secret.services.yml - Drupal\social_group_secret\EventSubscriber\SocialGroupSecretSubscriber
File
- modules/
social_features/ social_group/ modules/ social_group_secret/ src/ EventSubscriber/ SocialGroupSecretSubscriber.php, line 16
Namespace
Drupal\social_group_secret\EventSubscriberView source
class SocialGroupSecretSubscriber extends HttpExceptionSubscriberBase {
/**
* The currently active route match object.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected $routeMatch;
/**
* Constructs a new SocialGroupSecretSubscriber.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The currently active route match object.
*/
public function __construct(RouteMatchInterface $route_match) {
$this->routeMatch = $route_match;
}
/**
* {@inheritdoc}
*/
protected function getHandledFormats() {
return [
'html',
];
}
/**
* {@inheritdoc}
*/
protected static function getPriority() {
// We need a higher priority than R4032Login so that it doesn't create a
// response to login.
return 100;
}
/**
* {@inheritdoc}
*/
public function on403(GetResponseEvent $event) {
$group = $this->routeMatch
->getParameter('group');
// Show 404 page instead of 403 page for secret groups.
if ($group instanceof GroupInterface && $group
->bundle() === 'secret_group') {
// Change the exception to show as 404 instead of 403.
$event
->setException(new NotFoundHttpException());
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HttpExceptionSubscriberBase:: |
public static | function | Registers the methods in this class that should be listeners. | |
HttpExceptionSubscriberBase:: |
public | function | Handles errors for this subscriber. | |
SocialGroupSecretSubscriber:: |
protected | property | The currently active route match object. | |
SocialGroupSecretSubscriber:: |
protected | function |
Specifies the request formats this subscriber will respond to. Overrides HttpExceptionSubscriberBase:: |
|
SocialGroupSecretSubscriber:: |
protected static | function |
Specifies the priority of all listeners in this class. Overrides HttpExceptionSubscriberBase:: |
|
SocialGroupSecretSubscriber:: |
public | function | ||
SocialGroupSecretSubscriber:: |
public | function | Constructs a new SocialGroupSecretSubscriber. |