You are here

function acquia_agent_set_validate in Acquia Connector 6

Same name and namespace in other branches
  1. 7 acquia_agent/acquia_agent.pages.inc \acquia_agent_set_validate()

Validate acquia_agent_settings form submissions.

1 string reference to 'acquia_agent_set_validate'
acquia_agent_settings_form in acquia_agent/acquia_agent.pages.inc
Settings form builder function.

File

acquia_agent/acquia_agent.pages.inc, line 585
Acquia Agent configuration page.

Code

function acquia_agent_set_validate($form, &$form_state) {

  // Trim all input to get rid of possible whitespace pasted from the website.
  foreach ($form_state['values'] as $key => $value) {
    $form_state['values'][$key] = trim($value);
  }
  $identifier = $form_state['values']['acquia_identifier'];
  $key = $form_state['values']['acquia_key'];

  // Don't make the XML-RPC call with empty values.
  if (!empty($identifier) && !empty($key)) {
    if (!acquia_agent_valid_credentials($identifier, $key)) {
      $error_message = acquia_agent_connection_error_message();
      form_error($form, $error_message);
    }
  }
}