You are here

function hybridauth_admin_settings_validate in HybridAuth Social Login 7.2

Form validation handler for the hybridauth admin settings form.

File

./hybridauth.admin.inc, line 411
Administrative pages forms and functions for the HybridAuth module.

Code

function hybridauth_admin_settings_validate($form, &$form_state) {
  $values =& $form_state['values'];
  $providers = hybridauth_providers_list();

  // Remove weights so they are not saved as variables.
  foreach (array_keys($providers) as $provider_id) {
    $providers_weights[$provider_id] = $values['hybridauth_provider_' . $provider_id . '_weight'];
    unset($values['hybridauth_provider_' . $provider_id . '_weight']);
  }
  asort($providers_weights);
  $providers_values = $values['hybridauth_providers'];
  unset($values['hybridauth_providers']);
  foreach (array_keys($providers_weights) as $provider_id) {
    $values['hybridauth_providers'][$provider_id] = $providers_values[$provider_id];
  }

  // Cast hybridauth_debug to boolean.
  $values['hybridauth_debug'] = empty($values['hybridauth_debug']) ? FALSE : TRUE;
}