You are here

function clients_connection_drupal_services_6_2::testConnectionNodeLoad in Web Service Clients 6.2

Same name and namespace in other branches
  1. 7 backends/clients_drupal/clients_drupal.inc \clients_connection_drupal_services_6_2::testConnectionNodeLoad()
  2. 7.2 connections/clients_drupal/clients_drupal.inc \clients_connection_drupal_services_6_2::testConnectionNodeLoad()

Connection test button handler: loading a node on D6.

Overrides clients_connection_drupal_services::testConnectionNodeLoad

1 method overrides clients_connection_drupal_services_6_2::testConnectionNodeLoad()
clients_connection_drupal_services_5::testConnectionNodeLoad in connections/clients_drupal/clients_drupal.inc
Connection test button handler: loading a node.

File

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

Class

clients_connection_drupal_services_6_2
Drupal client for services on a Drupal 6 site for Services 6.x-2.x.

Code

function testConnectionNodeLoad(&$button_form_values) {

  // Must be cast to integer for faffiness of XMLRPC and Services.
  $nid = (int) $button_form_values['nid'];
  $fields = array();
  try {
    $node = $this
      ->callMethodArray('node.get', array(
      $nid,
      $fields,
    ));
  } catch (Exception $e) {
    drupal_set_message(t('Could not retrieve a node from the remote site, got error message "@message".', array(
      '@message' => $e
        ->getMessage(),
    )), 'warning');

    //dsm($e);
    return;
  }
  if (is_array($node) && isset($node['nid'])) {
    drupal_set_message(t('Sucessfully retrieved node %title (nid @nid).', array(
      '%title' => $node['title'],
      '@nid' => $node['nid'],
    )));
  }
  return $node;
}