public function MiniorangeSupport::submitForm in OAuth2 Login 8
Send support query.
Overrides FormInterface::submitForm
File
- src/
Form/ MiniorangeSupport.php, line 80 - Contains support form for miniOrange OAuth Server Module.
Class
Namespace
Drupal\oauth2_login\FormCode
public function submitForm(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
$email = trim($form['miniorange_oauth_client_email_address']['#value']);
$phone = trim($form['miniorange_oauth_client_phone_number']['#value']);
$query = trim($form['miniorange_oauth_client_support_query']['#value']);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
\Drupal::messenger()
->addMessage("Invalid Email Id format.", "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');
}
}