function services_admin_browse_index in Services 6.2
Same name and namespace in other branches
- 5 services_admin_browse.inc \services_admin_browse_index()
- 6 services_admin_browse.inc \services_admin_browse_index()
- 7 services_admin_browse.inc \services_admin_browse_index()
Page callback to list all enabled services and servers.
Return value
List of services and servers with links to test them.
1 string reference to 'services_admin_browse_index'
- services_menu in ./
services.module - Implementation of hook_menu().
File
- ./
services_admin_browse.inc, line 13 - Browser thru all services and servers.
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');
services_strip_hashes($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;
}