-
Notifications
You must be signed in to change notification settings - Fork 0
/
tripal_alchemist.module
79 lines (66 loc) · 2.17 KB
/
tripal_alchemist.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require_once 'includes/tripal_alchemist.api.inc';
/**
* implement hook menu
*/
function tripal_alchemist_menu() {
$admin_url_base = 'admin/tripal/extension/tripal_alchemist';
$items[$admin_url_base] = [
'title' => 'Tripal Alchemist',
'description' => t('Tripal Alchemist: Manage Tripal 3 Entities'),
'access arguments' => ['tripal alchemist'],
'page callback' => 'tripal_alchemist_admin_index_page',
];
$items[$admin_url_base . '/converter_form'] = [
'title' => 'Convert Entity Types',
'description' => t('Convert Tripal 3 Entities'),
'access arguments' => ['administer tripal'],
'page callback' => 'drupal_get_form',
'page arguments' => ['tripal_alchemist_converter_form'],
'file' => 'includes/tripal_alchemist_converter.form.inc',
'file_path' => drupal_get_path('module', 'tripal_alchemist'),
];
$items[$admin_url_base . "/unpublish_form"] = [
'title' => 'Delete Orphaned Entities',
'description' => t('Unpublish entities that have no associated records in their corresponding chado tables'),
'access arguments' => ['administer tripal'],
'page callback' => 'drupal_get_form',
'page arguments' => ['tripal_alchemist_unpublish_form'],
'file' => 'includes/tripal_alchemist.unpublish_form.inc',
'file_path' => drupal_get_path('module', 'tripal_alchemist'),
];
return $items;
}
/**
* Implements hook_cron_queue_info().
*/
function tripal_alchemist_cron_queue_info() {
$queues['tripal_alchemist'] = [
'worker callback' => 'tripal_alchemist_run_queue',
// 15 minutes per run
'time' => 60 * 15,
];
return $queues;
}
/**
* Tripal Alchemist admin index page.
*
* Lists all links in the main menu.
*
* @return string
*/
function tripal_alchemist_admin_index_page() {
$items = tripal_alchemist_menu();
// Exclude the first page
$admin_url_base = 'admin/tripal/extension/tripal_alchemist';
unset($items[$admin_url_base]);
$list = '';
foreach ($items as $url => $item) {
$list .= '<p><strong>';
$list .= l($item['title'] ?: 'missing title', $url);
$list .= '</strong></p>';
$list .= '<p>' . $item['description'] ?: '' . '</p>';
$list .= '<hr>';
}
return $list;
}