-
Notifications
You must be signed in to change notification settings - Fork 0
/
ding_format.module
57 lines (53 loc) · 1.64 KB
/
ding_format.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
<?php
// $id$
/**
* @file
* Ding formatter module
*
* Provides additional templating granularity for ting_objects
*/
/**
* implements hook_preprocess_ding_object
*/
function ding_format_preprocess_ting_object(&$vars) {
$object = $vars['object'];
$element = $vars['elements'];
if($element['#entity_type'] == 'ting_object') {
switch($object->getType()) {
case 'book':
// Book template
$vars['theme_hook_suggestions'][] = 'ting_object__book';
$vars['theme_hook_suggestions'][] = 'ting_object__book__' . $element['#view_mode'];
/*if (....) {
// Standard book template book.tpl.php
} else {
// Specific book template book--romankuffert.tpl.php
...
...
}*/
break;
case 'Cd (musik)':
case 'Node':
case 'Vinyl':
$vars['theme_hook_suggestions'][] = 'ting_object__musik';
$vars['theme_hook_suggestions'][] = 'ting_object__musik__' . $element['#view_mode'];
// Music template
// ..here is the actual hard work
break;
case 'Artikel':
case 'Avisartikel':
case 'Netdokument':
case 'Tidsskrift':
case 'Tidsskriftsartikel':
$vars['theme_hook_suggestions'][] = 'ting_object__article';
$vars['theme_hook_suggestions'][] = 'ting_object__article__' . $element['#view_mode'];
// Music template
// ..here is the actual hard work
break;
}
// Default classes
// $vars['classes'][] = drupal_html_class($element['language']);
// ..
// Other default classes?
}
}