-
Notifications
You must be signed in to change notification settings - Fork 0
/
flat_citation.module
54 lines (42 loc) · 1.03 KB
/
flat_citation.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
<?php
/**
* @file
* Flat Citation
*/
/**
* Implements hook_block_info().
*/
function flat_citation_block_info()
{
return array(
'flat_citation' => array(
'visibility' => BLOCK_VISIBILITY_LISTED,
'pages' => 'islandora/object/*',
'cache' => DRUPAL_CACHE_PER_PAGE,
'info' => t('FLAT citation from CMDI metadata'),
),
);
}
function flat_citation_get_citation(AbstractObject $object)
{
module_load_include('inc', 'flat_citation', 'includes/CitationGenerator');
$generator = new CitationGenerator();
$citation = $generator->generate($object->id);
return $citation;
}
/**
* Implements hook_block_view().
*/
function flat_citation_block_view()
{
$to_render = array();
$object = menu_get_object('islandora_object', 2);
if ($object) {
$citation = flat_citation_get_citation($object);
$result = "<p>" . $citation . "</p>";
if (isset($result)) {
$to_render['content'] = $result;
}
}
return $to_render;
}