You are here

function services_admin_browse_method in Services 6.2

Same name and namespace in other branches
  1. 5 services_admin_browse.inc \services_admin_browse_method()
  2. 6 services_admin_browse.inc \services_admin_browse_method()
  3. 7 services_admin_browse.inc \services_admin_browse_method()

Display a form for the testing of a single service method in the browser.

Parameters

$method: The method to be tested

Return value

Form for testing and method parameter info.

1 string reference to 'services_admin_browse_method'
services_menu in ./services.module
Implementation of hook_menu().

File

./services_admin_browse.inc, line 71
Browser thru all services and servers.

Code

function services_admin_browse_method($method) {
  global $_services_admin_browse_test_submit_result;
  $output = '';
  $output .= '<h3>' . $method['method'] . '</h3>';
  $output .= '<p>' . $method['help'] . '</p>';

  // List arguments.
  $output .= '<h3>' . t('Arguments') . ' (' . count($method['args']) . ')</h3>';
  $output .= '<dl id="service-browser-arguments">';
  $count = 0;
  foreach ($method['args'] as $arg) {
    $count++;
    $output .= '<dt><em class="type">' . $arg['type'] . '</em><strong class="name">' . ' ' . $arg['name'] . '</strong> (' . (isset($arg['optional']) && $arg['optional'] ? t('optional') : t('required')) . ')</dt>';
    $output .= '<dd>' . $arg['description'] . '</dd>';
  }
  $output .= '</dl>';

  // Allow testing of methods
  $output .= '<h3>' . t('Call method') . '</h3>';
  $output .= drupal_get_form('services_admin_browse_test');

  // Display results
  if ($_services_admin_browse_test_submit_result) {
    $output .= '<div id="output">';
    $output .= '<h3>' . t('Result') . '</h3>';
    $output .= '<code>' . $_services_admin_browse_test_submit_result . '</code>';
    $output .= '</div>';
  }
  return $output;
}