You are here

function units_currency_converters_currency in Units of Measurement 7.2

Same name and namespace in other branches
  1. 7 units_currency/plugins/converters/currency.inc \units_currency_converters_currency()

Units convert callback for converting through Currency module.

Parameters

float $value: Value in $from units that should be converted into $to units

Entity $from: Units entity in which $value is represented

Entity $to: Units entity into which $value should be converted

Return value

float $value converted into $to units

1 string reference to 'units_currency_converters_currency'
currency.inc in units_currency/plugins/converters/currency.inc

File

units_currency/plugins/converters/currency.inc, line 27

Code

function units_currency_converters_currency($value, $from, $to) {
  $rate = CurrencyExchanger::load($from->machine_name, $to->machine_name);
  if ($rate) {
    return currency_multiply($value, $rate);
  }
  return FALSE;
}