function commerce_currency_get_symbol in Commerce Core 7
Returns the symbol of any or all currencies.
Parameters
$code: Optional parameter specifying the code of the currency whose symbol to return.
Return value
Either an array of all currency symbols keyed by the currency code or a string containing the symbol for the specified currency. If a currency is specified that does not exist, this function returns FALSE.
1 call to commerce_currency_get_symbol()
- commerce_payment_tokens in modules/
payment/ commerce_payment.tokens.inc - Implements hook_tokens().
File
- ./
commerce.module, line 593 - Defines features and functions common to the Commerce modules.
Code
function commerce_currency_get_symbol($currency_code = NULL) {
$currencies = commerce_currencies();
// Return a specific currency symbol if specified.
if (!empty($currency_code)) {
if (isset($currencies[$currency_code])) {
return $currencies[$currency_code]['symbol'];
}
else {
return FALSE;
}
}
// Otherwise turn the array values into the type name only.
foreach ($currencies as $currency_code => $currency) {
$currencies[$currency_code] = $currency['symbol'];
}
return $currencies;
}