You are here

function services_admin_browse_method in Services 7

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. 6.2 services_admin_browse.inc \services_admin_browse_method()
1 string reference to 'services_admin_browse_method'
services_menu in ./services.module
Implements hook_menu().

File

./services_admin_browse.inc, line 58
@author Services Dev Team

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> (' . ($arg['#optional'] ? t('optional') : t('required')) . ')</dt>';
    $output .= '<dd>' . $arg['#description'] . '</dd>';
  }
  $output .= '</dl>';

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

  // @TODO this is a hack we should be trying to return a structure array if it is possible - this is just to fix existing behaviour
  $output .= drupal_render(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;
}