You are here

function units_currency_default_units_unit in Units of Measurement 7

Same name and namespace in other branches
  1. 7.2 units_currency/units_currency.module \units_currency_default_units_unit()

Implements hook_default_units_unit().

File

units_currency/units_currency.module, line 43
Integrate Units with Currency module.

Code

function units_currency_default_units_unit() {
  $items = array();
  $controller = entity_get_controller('units_unit');
  foreach (currency_load_all() as $currency) {
    if (!isset($currency->disabled) || !$currency->disabled) {
      $items[$currency->ISO4217Code] = $controller
        ->create(array(
        'measure' => 'currency',
        'machine_name' => $currency->ISO4217Code,
        'label' => $currency->title,
        'symbol' => $currency->sign,
        'description' => '',
        'factor' => NULL,
      ));
    }
  }
  return $items;
}