You are here

public function EventSubscribers::checkForInvite in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/modules/social_group_invite/src/EventSubscriber/EventSubscribers.php \Drupal\social_group_invite\EventSubscriber\EventSubscribers::checkForInvite()
  2. 10.0.x modules/social_features/social_group/modules/social_group_invite/src/EventSubscriber/EventSubscribers.php \Drupal\social_group_invite\EventSubscriber\EventSubscribers::checkForInvite()
  3. 10.1.x modules/social_features/social_group/modules/social_group_invite/src/EventSubscriber/EventSubscribers.php \Drupal\social_group_invite\EventSubscriber\EventSubscribers::checkForInvite()
  4. 10.2.x modules/social_features/social_group/modules/social_group_invite/src/EventSubscriber/EventSubscribers.php \Drupal\social_group_invite\EventSubscriber\EventSubscribers::checkForInvite()

Checks for group invite save.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The event when config is saved.

Throws

\Drupal\Core\Entity\EntityStorageException

File

modules/social_features/social_group/modules/social_group_invite/src/EventSubscriber/EventSubscribers.php, line 72

Class

EventSubscribers
Class CustomRedirects.

Namespace

Drupal\social_group_invite\EventSubscriber

Code

public function checkForInvite(ConfigCrudEvent $event) {
  $saved_config = $event
    ->getConfig()
    ->getRawData();

  // When group_invitation is enabled, add some default config.
  if (!empty($saved_config['group_type']) && !empty($saved_config['content_plugin']) && $saved_config['content_plugin'] === 'group_invitation') {

    // Load the Group type and add permissions.
    $group_type = GroupType::load($saved_config['group_type']);
    if ($group_type instanceof GroupTypeInterface) {
      social_group_invite_set_default_permissions_for_group_type($group_type);
    }
  }
}