You are here

function clients_connection_test_form_submit in Web Service Clients 7.2

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

Submit handler for the connection test page.

File

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

Code

function clients_connection_test_form_submit($form, &$form_state) {

  //dsm($form_state);
  $connection = $form['#connection'];
  $button_key = $form_state['clicked_button']['#key'];
  $submit_handler = $form_state['clicked_button']['#action_submit'];

  // Only pass the method the values that are related to it; everything else is just cruft.
  $button_form_values = $form_state['values']['buttons'][$button_key];

  // The submit callback is either a method on the connection object or a regular function.
  if ($form_state['clicked_button']['#action_type'] == 'method') {
    $result = $connection
      ->{$submit_handler}($button_form_values);
  }
  else {
    $result = $submit_handler($button_form_values);
  }

  // Place the data returned from the connection in the form for display.
  $form_state['storage'][$button_key] = $result;
}