You are here

function clients_connection_test_form_validate in Web Service Clients 7.3

Same name and namespace in other branches
  1. 6.2 clients.connection.admin.inc \clients_connection_test_form_validate()
  2. 7 clients.connection.admin.inc \clients_connection_test_form_validate()
  3. 7.2 clients.connection.admin.inc \clients_connection_test_form_validate()

Validate handler for the connection test page.

Call the validate handler on the test class, if it has one.

File

includes/clients.connection.admin.inc, line 438
clients.connection.admin.inc Page callbacks relating to client connection admin.

Code

function clients_connection_test_form_validate($form, &$form_state) {
  $connection = $form['#connection'];
  $type_definition = $form['#connection_type'];
  $test_name = $form_state['clicked_button']['#name'];
  if (isset($form_state['clicked_button']['#name'])) {
    $test_class = $type_definition['tests'][$test_name];
    $test_handler = new $test_class();

    // Call formValidate() on the test handler. This allows handlers to validate
    // their test form element.
    if (method_exists($test_handler, 'formValidate')) {
      $test_handler
        ->formValidate($form_state['values']['buttons'][$test_name]);
    }
  }
}