You are here

function clients_connection_drupal_services::testConnectionConnect in Web Service Clients 6.2

Same name and namespace in other branches
  1. 7.2 connections/clients_drupal/clients_drupal.inc \clients_connection_drupal_services::testConnectionConnect()

Connection test button handler: basic connection.

Connection test handlers should return the raw data they got back from the connection for display to the user.

File

connections/clients_drupal/clients_drupal.inc, line 101
Contains classes for Client connections handlers.

Class

clients_connection_drupal_services
Base class for Drupal client connections.

Code

function testConnectionConnect(&$button_form_values) {
  try {

    // Call the connect method.
    $connect = $this
      ->callMethodArray('system.connect');
  } catch (Exception $e) {
    drupal_set_message(t('Could not connect to the remote site, got error message "@message".', array(
      '@message' => $e
        ->getMessage(),
    )), 'warning');

    //dsm($e);
    return;
  }
  if (is_array($connect) && isset($connect['user'])) {
    drupal_set_message(t('Sucessfully connected to the remote site.'));
  }
  else {
    drupal_set_message(t('Could not connect to the remote site.'), 'warning');
  }
  return $connect;
}