function services_admin_browse_index in Services 5
Same name and namespace in other branches
- 6 services_admin_browse.inc \services_admin_browse_index()
- 6.2 services_admin_browse.inc \services_admin_browse_index()
- 7 services_admin_browse.inc \services_admin_browse_index()
Callback for 'services/browse'.
1 string reference to 'services_admin_browse_index'
- services_menu in ./
services.module - Implementation of hook_menu.
File
- ./
services_admin_browse.inc, line 9 - The file contains code which is used to create the services testing interface
Code
function services_admin_browse_index() {
$methods = services_get_all();
// Show enable server modules.
$servers = module_implements('server_info');
$output .= '<h2>' . t('Servers') . '</h2>';
if (!empty($servers)) {
$output .= '<ul>';
foreach ($servers as $module) {
$info = module_invoke($module, 'server_info');
$name = $info['#name'];
$path = 'services/' . $info['#path'];
$output .= '<li class="leaf">' . l($name . " - /{$path}", $path) . '</li>';
}
$output .= '</ul>';
}
else {
$output .= '<p>' . t('You must enable at least one server module to be able to connect remotely. Visit the <a href="@url">modules</a> page to enable server modules.', array(
'@url' => url('admin/build/modules'),
)) . '</p>';
}
$output .= '<h2>' . t('Services') . '</h2>';
// group namespaces
$services = array();
foreach ($methods as $method) {
$namespace = drupal_substr($method['#method'], 0, strrpos($method['#method'], '.'));
$services[$namespace][] = $method;
}
if (count($services)) {
foreach ($services as $namespace => $methods) {
$output .= '<h3>' . $namespace . '</h3>';
$output .= '<ul>';
foreach ($methods as $method) {
$output .= '<li class="leaf">' . l($method['#method'], 'admin/build/services/browse/' . $method['#method']) . '</li>';
}
$output .= '</ul>';
}
}
else {
$output .= t('No services have been enabled.');
}
return $output;
}