You are here

public function SocialEventInviteConfigOverride::loadOverrides in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_event/modules/social_event_invite/src/SocialEventInviteConfigOverride.php \Drupal\social_event_invite\SocialEventInviteConfigOverride::loadOverrides()
  2. 10.2.x modules/social_features/social_event/modules/social_event_invite/src/SocialEventInviteConfigOverride.php \Drupal\social_event_invite\SocialEventInviteConfigOverride::loadOverrides()

Load overrides.

Overrides ConfigFactoryOverrideInterface::loadOverrides

File

modules/social_features/social_event/modules/social_event_invite/src/SocialEventInviteConfigOverride.php, line 75

Class

SocialEventInviteConfigOverride
Provides an overridden elements.

Namespace

Drupal\social_event_invite

Code

public function loadOverrides($names) {
  $overrides = [];
  $config_name = 'user.settings';

  // Get default verify_mail users settings.
  $verify_mail = $this->configFactory
    ->getEditable($config_name)
    ->get('verify_mail');

  // Get email_verification status of social event invite settings.
  $event_invite = $this->configFactory
    ->getEditable('social_event_invite.settings');
  $ignore_email_verification = $event_invite
    ->get('email_verification');

  // Skip email verification step on registration for user event invitation.
  if (in_array($config_name, $names, TRUE) && $ignore_email_verification === TRUE && $verify_mail === TRUE) {
    $request = $this->requestStack
      ->getCurrentRequest();
    $invitee_mail = $request->query
      ->get('invitee_mail', '');
    $destination = $request->query
      ->get('destination', '');
    $is_valid = $this
      ->validateInviteData($invitee_mail, $destination);
    if ($is_valid) {
      $overrides[$config_name]['verify_mail'] = FALSE;
    }
  }
  return $overrides;
}