Skip to content

ISO 4217 currencies as a Drupal field

A field type that stores a currency's three-letter code, a select widget that lists the current ISO 4217 currencies, and a formatter that shows the code, the currency name or the country.

For Drupal 10.3+, 11 and 12 ยท No dependencies outside core

The Invoice currency select on a node edit form, listing currency names with Euro selected.

What it does

Editors pick a currency from a list instead of typing a code. The field stores the alphabetic code, such as EUR, and rejects anything that is not an ISO 4217 code.

  • Field type currency_field: one value column holding the alphabetic code. Values are validated against every code in the bundled list, current and withdrawn.
  • Widget currency_widget: a select of current currencies, labelled by code, currency name or country, sorted by label, with an empty option. A withdrawn currency that an item already stores stays selectable.
  • Formatter currency_formatter: shows the code (the default), the currency name or the country name, as plain text.
  • Data: currencies.yml, generated from the ISO 4217 lists published by SIX, the maintenance agency. No API calls or external services.

It suits any site that records prices, invoices, fares or accounts in more than one currency. GTFS Core uses it for fare product prices.

The node page showing Invoice currency: Euro and Accepted currencies: EUR, GBP, USD.

Documentation