function monitoring_value_label_callback_commerce_currency in Monitoring 7
Formatter for commerce currency amount value.
Parameters
\Drupal\monitoring\Result\SensorResultInterface $result: Result object for which to get the formatted value.
Return value
string Formatted amount.
See also
1 string reference to 'monitoring_value_label_callback_commerce_currency'
- monitoring_value_types in ./
monitoring.module - Gets available value types definitions.
File
- ./
monitoring.module, line 732 - Monitoring bootstrap file.
Code
function monitoring_value_label_callback_commerce_currency(SensorResultInterface $result) {
if (module_exists('commerce')) {
$currency = $result
->getSensorInfo()
->getSetting('currency_code');
if (empty($currency)) {
$currency = commerce_default_currency();
}
// commerce_currency_format() uses @placeholders and runs the price through
// check_plain(), that can cause double encoding, so decode entities again.
return html_entity_decode(commerce_currency_format($result
->getValue(), $currency, NULL, FALSE), ENT_QUOTES);
}
return $result
->getValue();
}