-
Notifications
You must be signed in to change notification settings - Fork 10
/
uc_store.theme.inc
110 lines (100 loc) · 2.68 KB
/
uc_store.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* @file
* Theme functions for the uc_store module.
*/
/**
* Displays a price in the standard format and with consistent markup.
*
* @param $variables
* An associative array containing:
* - price: A numerical price value.
* - suffixes: An array of suffixes to be attached to this price.
*
* @ingroup themeable
*/
function theme_uc_price($variables) {
$output = '<span class="uc-price">' . uc_currency_format($variables['price']) . '</span>';
if (!empty($variables['suffixes'])) {
$output .= '<span class="price-suffixes">' . implode(' ', $variables['suffixes']) . '</span>';
}
return $output;
}
/**
* Displays "Quantity" abbreviated as "Qty".
*
* @ingroup themeable
*/
function theme_uc_qty_label() {
return '<abbr title="' . t('Quantity') . '">' . t('Qty') . '</abbr>';
}
/**
* Displays a quantity.
*
* @param $variables
* An associative array containing:
* - qty: The quantity to display.
*
* @ingroup themeable
*/
function theme_uc_qty($variables) {
return $variables['qty'] . ' ×';
}
/**
* Displays a username in the standard format and with consistent markup.
*
* @param $variables
* An associative array containing:
* - uid: A user ID value.
*
* @ingroup themeable
*/
function theme_uc_uid($variables) {
if ($variables['uid']) {
return theme('username', array('account' => user_load($variables['uid'])));
}
else {
return '-';
}
}
/**
* Wraps the footer in a div so it can be re-styled.
*
* @param $variables
* An associative array containing:
* - message: String containing footer text.
*
* @ingroup themeable
*/
function theme_uc_store_footer($variables) {
return '<div id="store-footer">' . $variables['message'] . '</div>';
}
/**
* Themes a pane sorting form into a table.
*
* @param $variables
* An associative array containing:
* - form: A render element representing the form.
*
* @ingroup themeable
*/
function theme_uc_pane_sort_table($variables) {
$form = $variables['form'];
$prefix = $form['#pane_prefix'];
$attributes = array();
if (isset($form['#draggable'])) {
$attributes['id'] = $form['#draggable'] . '-table';
backdrop_add_tabledrag($form['#draggable'] . '-table', 'order', 'sibling', $form['#draggable']);
}
$header = array(t('Pane'), t('List position'));
foreach (element_children($form) as $pane_id) {
$rows[] = array(
'data' => array(
backdrop_render($form[$pane_id][$prefix . '_' . $pane_id . '_enabled']),
backdrop_render($form[$pane_id][$prefix . '_' . $pane_id . '_weight']),
),
'class' => array('draggable'),
);
}
return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes)) . '<br />';
}