-
Notifications
You must be signed in to change notification settings - Fork 9
/
createapi.admin.inc
86 lines (74 loc) · 2.36 KB
/
createapi.admin.inc
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* @file
*
* Admin file for Create API.
*/
/**
* Admin listing for CreateAPI Exposed Paths.
*/
function createapi_admin_listing() {
// Lets create a table for listing.
$header = array();
$header[] = array(
'data' => t('Path'),
'field' => 'path',
'sort' => 'asc',
);
$header[] = array(
'data' => t('System'),
'field' => 'system',
);
$rows = array();
$content_type_endpoints = module_invoke_all('createapi_content_types');
foreach ($content_type_endpoints as $content_type => $endpoint) {
$path = 'api/' . $endpoint['version'] . '/' . $endpoint['path'];
$row = array();
$row['data']['path'] = l($path, $path);
$row['data']['module'] = 'Content Type';
$rows[] = $row;
}
$queue_endpoints = module_invoke_all('createapi_nodequeues');
foreach ($queue_endpoints as $queue_name => $endpoint) {
$path = 'api/' . $endpoint['version'] . '/' . $endpoint['path'];
$row = array();
$row['data']['path'] = l($path, $path);
$row['data']['module'] = 'NodeQueues';
$rows[] = $row;
}
$menu_endpoints = module_invoke_all('createapi_menus');
foreach ($menu_endpoints as $menu_name => $endpoint) {
$path = 'api/' . $endpoint['version'] . '/' . $endpoint['path'];
$row = array();
$row['data']['path'] = l($path, $path);
$row['data']['module'] = 'Menus';
$rows[] = $row;
}
$variable_endpoints = module_invoke_all('createapi_variables');
foreach ($variable_endpoints as $endpoint_name => $endpoint) {
$path = 'api/' . $endpoint['version'] . '/' . $endpoint['path'];
$row = array();
$row['data']['path'] = l($path, $path);
$row['data']['module'] = 'Variable';
$rows[] = $row;
}
$custom_endpoints= module_invoke_all('createapi_custom_entities_info');
foreach ($custom_endpoints as $endpoint_name => $endpoint) {
$path = 'api/' . $endpoint['version'] . '/' . $endpoint['path'];
$row = array();
$row['data']['path'] = l($path, $path);
$row['data']['module'] = 'Entities';
$rows[] = $row;
}
$build['path_table'] = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#empty' => t('No CreateAPI paths are available.'),
);
$build['path_pager'] = array('#theme' => 'pager');
return $build;
return $form;
// Currently the module has no settings but leave this here for now.
// return system_settings_form($form);
}