You are here

public function miniorange_oauth_clientController::miniorange_oauth_client_update_email_username_attribute in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 8

1 call to miniorange_oauth_clientController::miniorange_oauth_client_update_email_username_attribute()
miniorange_oauth_clientController::miniorange_oauth_client_mo_login in src/Controller/miniorange_oauth_clientController.php

File

src/Controller/miniorange_oauth_clientController.php, line 527
Contains \Drupal\miniorange_oauth_client\Controller\DefaultController.

Class

miniorange_oauth_clientController

Namespace

Drupal\miniorange_oauth_client\Controller

Code

public function miniorange_oauth_client_update_email_username_attribute($data) {
  $options = '';
  $selected_flag = 0;
  foreach ($data as $key => $value) {
    if ($selected_flag == 0 && ($key == 'email' || $key == 'email.0')) {
      $options = $options . '<option value="email" selected> email </option>';
      $selected_flag = 1;
    }
    elseif ($selected_flag == 0 && ($key == 'emails' || $key == 'emails.0')) {
      $options = $options . '<option value="emails" selected> emails </option>';
      $selected_flag = 1;
    }
    else {
      $options = $options . '<option value="' . $key . '"> ' . $key . ' </option>';
    }
  }
  $html_string = '<p style="display: inline-block;">&emsp;<b> Email Attribute </b></p> &nbsp;&nbsp;&nbsp; <select id="mo_oauth_email_attribute" style="height: 32px;">' . $options . '</select>
                        &nbsp;&nbsp;&nbsp; <input style="display: none;" id="miniorange_oauth_client_other_field_for_email" placeholder="Enter Email Attribute">';
  echo $html_string . '';
  return new Response();
}