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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
<?php
// $Id$
/**
* @file
* User page callbacks for the filter module.
*/
/**
* Menu callback; show a page with long filter tips.
*/
function filter_tips_long() {
$format = arg(2);
if ($format) {
$output = theme('filter_tips', _filter_tips($format, TRUE), TRUE);
}
else {
$output = theme('filter_tips', _filter_tips(-1, TRUE), TRUE);
}
return $output;
}
/**
* Render HTML for a set of filter tips.
*
* @param $tips
* An array containing descriptions and a CSS id in the form of
* 'module-name/filter-id' (only used when $long is TRUE) for each input
* filter in one or more input formats. Example:
* @code
* array(
* 'Full HTML' => array(
* 0 => array(
* 'tip' => 'Web page addresses and e-mail addresses turn into links automatically.',
* 'id' => 'filter/2',
* ),
* ),
* );
* @endcode
* @param $long
* (optional) Whether the passed in filter tips contain extended explanations,
* i.e. intended to be output on the path 'filter/tips' (TRUE), or are in a
* short format, i.e. suitable to be displayed below a form element. Defaults
* to FALSE.
*
* @see _filter_tips()
* @ingroup themeable
*/
function theme_filter_tips($tips, $long = FALSE) {
$output = '';
$multiple = count($tips) > 1;
if ($multiple) {
$output = t('Input formats') . ':';
}
if (count($tips)) {
if ($multiple) {
$output .= '<ul>';
}
foreach ($tips as $name => $tiplist) {
if ($multiple) {
$output .= '<li>';
$output .= '<strong>' . $name . '</strong>:<br />';
}
if (count($tiplist) > 0) {
$output .= '<ul class="tips">';
foreach ($tiplist as $tip) {
$output .= '<li' . ($long ? ' id="filter-' . str_replace("/", "-", $tip['id']) . '">' : '>') . $tip['tip'] . '</li>';
}
$output .= '</ul>';
}
if ($multiple) {
$output .= '</li>';
}
}
if ($multiple) {
$output .= '</ul>';
}
}
return $output;
}
|