forked from ding2/ting_relation
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathting_relation.module
More file actions
71 lines (63 loc) · 1.98 KB
/
ting_relation.module
File metadata and controls
71 lines (63 loc) · 1.98 KB
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
<?php
/**
* @file
* Handles relations for Ting entities.
*/
// Load Field module hooks.
module_load_include('field.inc', 'ting_relation');
/**
* Implements hook_theme().
*/
function ting_relation_theme() {
return array(
'ting_relation' => array(
'template' => 'ting_relation',
'render element' => 'elements',
'file' => 'ting_relation.theme.inc',
),
);
}
/**
* kind of a hook - called from ting.module
*/
function ting_relation_anchor_info() {
$ret = ting_relation_inline();
unset($ret['dbcaddi:hasOnlineAccess']);
unset($ret['dbcaddi:isReviewOf']);
unset($ret['dbcaddi:isPartOfManifestation']);
return $ret;
}
/**
* Inline relation types and their titles.
*/
function ting_relation_inline() {
static $types;
if (!$types) {
$types = array(
'dbcaddi:hasCreatorDescription' => t('Author portrait'),
'dbcaddi:hasReview' => t('Review'),
'dbcaddi:hasSubjectDescription' => t('Subject description'),
'dbcaddi:isPartOfManifestation' => t('Is part of manifestation'),
'dbcaddi:isReviewOf' => t('Is review of'),
'dbcaddi:hasOnlineAccess' => t('Online access'),
);
}
return $types;
}
/**
* Implements hook_form_FORM_ID_alter()
* Adding ebrary url form field to Ting configurating form
* Set required to FALSE - this is a part of the relation-module, and not everybody wants or has access to ebrary
* TODO this field requires configuration. Maybe it should be moved to a module of its own?
* this url is restricted ;'http://site.ebrary.com/lib/metropol/docDetail.action?docID=';
* - probably for metropol access.
*/
function ting_relation_form_ting_admin_ting_settings_alter(&$form, &$form_state) {
$form['ting']['ting_ebrary_url'] = array(
'#type' => 'textfield',
'#title' => t(' URL to ebrary '),
'#description' => t('BASE URL to site.ebrary.com e.g.http://site.ebrary.com/lib/librarytitles/docDetail.action?docID='),
'#required' => FALSE,
'#default_value' => variable_get('ting_ebrary_url', ''),
);
}