forked from ding2/ting
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathting.theme.inc
More file actions
37 lines (31 loc) · 1.02 KB
/
ting.theme.inc
File metadata and controls
37 lines (31 loc) · 1.02 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
<?php
/**
* @file
* Theming functions for ting.
*/
/**
* Template preprocessor for ting objects.
*/
function template_preprocess_ting_object(&$variables) {
$variables['object'] = $variables['elements']['#object'];
$variables['page'] = $variables['elements']['#view_mode'] == 'full';
$variables['classes_array'][] = drupal_html_class('view-mode-' . $variables['elements']['#view_mode']);
// Helpful $content variable for templates.
foreach (element_children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
if ( isset($variables['content']['entities']) ) {
foreach ( $variables['content']['entities'] as $key => $val ) {
$variables['content']['overview']['types'][] = $key;
}
}
}
/**
* Helper function to format abstracts from ting.
*/
function ting_format_abstract($string) {
$string = str_replace('Indhold:', '', $string);
$string = str_replace(' ; ', '<br/>', $string);
$string = str_replace(' / ', '<br/>', $string);
return $string;
}