-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubl_batch_compound.module
80 lines (74 loc) · 2.49 KB
/
ubl_batch_compound.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
/**
* @file
* Add compound items in batch
*
*
* Copyright 2017 Leiden University Library
*
* This file is part of ubl_batch_compound.
*
* ubl_batch_compound is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Permissions.
define('UBL_BATCH_COMPOUND_IMPORT_CSV', 'Generate compound items from CSV file');
/**
* Implements hook_menu().
*/
function ubl_batch_compound_menu() {
return array(
'ubl_batch_compound' => array(
'title' => 'Generate compound items from CSV file',
'type' => MENU_NORMAL_ITEM,
'page callback' => 'drupal_get_form',
'page arguments' => array('ubl_batch_compound_import_form'),
'file' => 'includes/ubl_batch_compound_csv_import.form.inc',
'access arguments' => array(UBL_BATCH_COMPOUND_IMPORT_CSV),
),
'ubl_batch_compound/confirm' => array(
'title' => 'Confirm batch compound items',
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
'page arguments' => array('ubl_batch_compound_import_confirm_form'),
'file' => 'includes/ubl_batch_compound_csv_import.form.inc',
'access arguments' => array(UBL_BATCH_COMPOUND_IMPORT_CSV),
),
);
}
/**
* Implements hook_permission().
*/
function ubl_batch_compound_permission() {
return array(
UBL_BATCH_COMPOUND_IMPORT_CSV => array(
'title' => t('Generate compound items'),
'description' => t('Generate compound items from a user-supplied CSV file'),
),
);
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function ubl_batch_compound_form_system_modules_alter(&$form, &$form_state, $form_id) {
$form['modules']['UBL']['ubl_batch_compound']['links']['configure'] = array(
'#type' => 'link',
'#title' => t('Configure'),
'#href' => 'ubl_batch_compound',
'#options' => array('attributes' => array(
'class' => array('module-link','module-link-configure'),
'title' => t('Setup a batch compound'),
)),
);
}