forked from ding2/ding_periodical
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathding_periodical.module
More file actions
48 lines (42 loc) · 1.29 KB
/
ding_periodical.module
File metadata and controls
48 lines (42 loc) · 1.29 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
<?php
/**
* @file
* Shows issue information on periodicals.
*/
// Load Field module hooks.
module_load_include('inc', 'ding_periodical', 'ding_periodical.field');
/**
* Implements hook_theme().
*/
function ding_periodical_theme() {
return array(
'ding_periodical_issues' => array(
// 'variables' => array('entity', 'issues'),
'render element' => 'elements',
),
);
}
/**
* Theming function.
*/
function theme_ding_periodical_issues($variables) {
$items = array();
foreach ($variables['elements']['#issues'] as $volume => $issues) {
$iss = array();
foreach ($issues as $key => $availability) {
$issue = $key;
// check user
if ($availability['reservable'] && module_exists('ding_periodical_reservation')) {
$issue .= ' ' . ding_periodical_reservation_button($availability['local_id'], $volume, $key, $variables['elements']['#entity']);
}
$iss[] = $issue;
}
$vol = array(
'data' => '<div class="'.drupal_html_class('ding_periodical_fold').'">'.$volume.'</div>',
'children' => $iss,
'class' => array(drupal_html_class('ding_periodical_foldable'),),
);
$items[] = $vol;
}
return theme('item_list', array('items' => $items,'attributes'=>array('class'=>drupal_html_class('ding_periodical_issues'))));
}