forked from jrbeeman/services_docs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
services_docs.module
59 lines (46 loc) · 1.4 KB
/
services_docs.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* @file
* Generates user-friendly documentation for the services available on the site.
*/
function services_docs_autoload_info() {
return array(
'RESTServicesDocsViewBuiltIn' => array(
'file' => 'includes/RESTServicesDocsView.inc',
),
);
}
function services_docs_services_resources() {
require_once("resources/rest_wadl_doc.inc");
$resources = array();
$resources += services_docs_rest_wadl_resource_definition();
return $resources;
}
function services_docs_rest_server_response_formatters_alter(&$formatters) {
// TODO: if this is a call correlated to a services_doc callback?
// @todo this breaks the rest of the XML formatters for services returns
$formatters['xml']['view'] = "RESTServicesDocsView";
}
/**
* Implementation of hook_perm().
*/
function services_docs_perm() {
return array('access services documentation');
}
/**
* Implementation of hook_menu().
*/
function services_docs_menu() {
$items = array();
$items['wadl.xsl'] = array(
'page callback' => 'services_docs_services_definition_endpoint',
'access arguments' => array('access services documentation'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
function services_docs_services_definition_endpoint() {
$xsl = "/lib/wadl.xsl"; // NOTE: Old: /lib/wadl_documentation-2006-10.xsl
print_r(file_get_contents(drupal_get_path('module', "services_docs") . $xsl));
exit();
}