You are here

public static function Utilities::send_support_query in OAuth2 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
Send support query.
Settings::saved_support in src/Form/Settings.php
Send support query.

File

src/Utilities.php, line 178

Class

Utilities

Namespace

Drupal\oauth2_login

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 (!valid_email_address($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');
  }
}