function theme_money_field in Money field 6
Display an amount and currency with the given display options.
Parameters
$amount: The amount (raw or formatted).
$currency: The currency code.
$display_options: The string that provides display options as configured in widget settings.
$separator: The character used as a separator when specified by '+' is display options. Defaults to non-break space.
3 theme calls to theme_money_field()
- money_conversion_dialog_ajax_callback in modules/
money_conversion_dialog/ money_conversion_dialog.module - Menu callback to deal with our own ajax requests.
- theme_money_formatter_generic in ./
money.module - Display a CCK Money field (formatted).
- theme_money_formatter_unformatted in ./
money.module - Display a CCK Money field (unformatted).
File
- ./
money.module, line 464 - This module defines the Money CCK field.
Code
function theme_money_field($amount, $currency, $display_options, $separator = " ") {
$output = '';
foreach (explode('|', $display_options) as $option) {
switch ($option) {
case 'a':
// The amount.
$output .= $amount;
break;
case 's':
// Currency symbol.
$currency_symbols = currency_api_get_symbols();
if (isset($currency_symbols[$currency])) {
$output .= $currency_symbols[$currency];
break;
}
// Fall back to currency code.
case 'c':
// Currency code.
$output .= $currency;
break;
case '+':
// Separator.
$output .= $separator;
break;
}
}
return $output;
}