-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgapi.theme.inc
57 lines (53 loc) · 1.42 KB
/
pgapi.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
<?php
/**
* @file
* Provides theme functions.
*/
/**
* Theme function for formating price with html.
*
* @param array $values
* - format Price to format.
* - symbol Symbol of currency.
* - position Position of price and it symbol.
*
* @return string
* Formatted price.
*/
function theme_pgapi_format_price($values) {
if ($values['position']) {
$output = '<div class="price"><span class="symbol">' . $values['symbol'] . '</span> ' . $values['price'] . '</div>';
}
else {
$output = '<div class="price">' . $values['price'] . '<span class="symbol">' . $values['symbol'] . '</span></div>';
}
return $output;
}
/**
* Theme function for formating price without html.
*
* @param array $values
* - price Price to format.
* - symbol Symbol of currency.
* - position Position of price and it symbol.
*
* @return string
* Formatted price.
*/
function theme_pgapi_format_price_plain($values) {
if ($values['position']) {
$output = $values['symbol'] . ' ' . $values['price'];
}
else {
$output = $values['price'] . ' ' . $values['symbol'];
}
return $output;
}
/**
* Implements template_preprocess_THEMENAME().
*/
function template_preprocess_payment(&$values) {
$transaction = $values['transaction'];
$values['image'] = drupal_get_path('module', 'pgapi') . '/payment.png';
$values['service_details'] = module_invoke($transaction->service, 'pgapi_payment_details', $transaction);
}