You are here

function clients_connection_drupal_services_5::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_5::testConnectionNodeLoad()
  2. 7.2 connections/clients_drupal/clients_drupal.inc \clients_connection_drupal_services_5::testConnectionNodeLoad()

Connection test button handler: loading a node.

This uses a different method on Services 5.x-0.92.

Overrides clients_connection_drupal_services_6_2::testConnectionNodeLoad

File

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

Class

clients_connection_drupal_services_5
Drupal client for services on a Drupal 5 site.

Code

function testConnectionNodeLoad(&$button_form_values) {
  $nid = $button_form_values['nid'];
  try {
    $node = $this
      ->callMethodArray('node.load', array(
      $nid,
    ));
  } 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'],
    )));
  }
  else {
    drupal_set_message(t('Could not retrieve a node from the remote site.'), 'warning');
  }
  return $node;
}