You are here

public static function Utilities::send_support_query in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 8

4 calls to Utilities::send_support_query()
MiniorangeConfigOAuthClient::saved_support in src/Form/MiniorangeConfigOAuthClient.php
Send support query.
MiniorangeMapping::saved_support in src/Form/MiniorangeMapping.php
Send support query.
MiniorangeOAuthClientCustomerSetup::saved_support in src/Form/MiniorangeOAuthClientCustomerSetup.php
Settings::saved_support in src/Form/Settings.php

File

src/Utilities.php, line 183

Class

Utilities

Namespace

Drupal\miniorange_oauth_client

Code

public static function send_support_query($email, $phone, $query) {
  if (empty($email) || empty($query)) {
    \Drupal::messenger()
      ->addMessage(t('The <b><u>Email</u></b> and <b><u>Query</u></b> fields are mandatory.'), 'error');
    return;
  }
  elseif (!\Drupal::service('email.validator')
    ->isValid($email)) {
    \Drupal::messenger()
      ->addMessage(t('The email address <b><i>' . $email . '</i></b> is not valid.'), 'error');
    return;
  }
  $support = new MiniorangeOAuthClientSupport($email, $phone, $query);
  $support_response = $support
    ->sendSupportQuery();
  if ($support_response) {
    \Drupal::messenger()
      ->addMessage(t('Support query successfully sent. We will get back to you shortly.'));
  }
  else {
    \Drupal::messenger()
      ->addMessage(t('Error sending support query'), 'error');
  }
}