You are here

function siteimprove_admin_settings_form_ajax_request_token in Siteimprove 7

Ajax callback function for requesting a new Siteimprove token.

Return value

array Renderable array (the box element)

1 string reference to 'siteimprove_admin_settings_form_ajax_request_token'
siteimprove_admin_settings_form in ./siteimprove.admin.inc
Implements hook_admin_settings() for module settings configuration.

File

./siteimprove.admin.inc, line 74
Administrative page callbacks for the siteimprove module.

Code

function siteimprove_admin_settings_form_ajax_request_token($form, $form_state) {

  // Request new token.
  if ($token = SiteimproveUtils::requestToken()) {
    $form['token']['siteimprove_token']['#value'] = $token;
  }
  else {
    form_set_error('siteimprove_token', t('There was an error requesting a new token. Please try again in a few minutes.'));
  }
  return $form['token']['siteimprove_token'];
}