-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtagadelic.theme.inc
68 lines (60 loc) · 1.71 KB
/
tagadelic.theme.inc
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
<?php
/**
* @file
* Theme functions for tagadelic module.
*/
/**
* Theme function that renders an entry in tagadelic/list/ views.
*
* @param $vocabulary
* A fully loaded taxonomy Vocabulary object, where name amd description have
* been previously sanitized.
* @param $tags
* An array with weighted tag objects.
*
* @ingroup themable
*/
function theme_tagadelic_list_box($variables = array()) {
$vocabulary = $variables['vocabulary'];
$tags = $variables['tags'];
$content = theme('tagadelic_weighted', array('terms' => $tags));
$output = '<h2>' . $vocabulary->name . '</h2>';
if ($vocabulary->description) {
$output .= '<div>' . $vocabulary->description . '</div>';
}
$output .= '<div>' . $content . '</div>';
backdrop_add_css(backdrop_get_path('module', 'tagadelic') . '/tagadelic.css');
return $output;
}
/**
* Theme function that renders the HTML for the tag cloud.
*
* @param array $variables
* An array containing the following keys:
* - terms: Array of taxonomy term data, including:
* - name: Sanitized term name.
* - tid: term ID.
* - weight: term weight.
* - description: Sanitized term description.
*
* @return string
* The output.
*
* @ingroup themable
*/
function theme_tagadelic_weighted($variables = array()) {
$terms = $variables['terms'];
$output = '';
foreach ($terms as $term) {
$output .= l($term->name, 'taxonomy/term/' . $term->tid, array(
'attributes' => array(
'class' => array('tagadelic', 'level' . $term->weight),
'rel' => 'tag',
'title' => $term->description,
)
)
) . " \n";
}
backdrop_add_css(backdrop_get_path('module', 'tagadelic') . '/tagadelic.css');
return $output;
}