You are here

function currency_element_info in Currency 7.2

Implements hook_element_info().

File

currency/currency.module, line 105
Provides currency information and allows users to add custom currencies.

Code

function currency_element_info() {

  // An element to collect an amount of money and convert it to a numeric string.
  $elements['currency_amount'] = array(
    '#input' => TRUE,
    '#process' => array(
      'currency_form_currency_amount_process',
    ),
    '#default_value' => array(
      'amount' => NULL,
      'currency_code' => 'XXX',
    ),
    '#element_validate' => array(
      'currency_form_currency_amount_validate',
    ),
    // The minimum amount as a numeric string, or FALSE to omit.
    '#minimum_amount' => FALSE,
    // The maximum amount as a numeric string, or FALSE to omit.
    '#maximum_amount' => FALSE,
    // The ISO 4217 code of the currency the amount should be in. Use FALSE to
    // let users choose.
    '#currency_code' => FALSE,
  );

  // A locale selector. Returns a string in the format of xx_ZZ.
  $elements['currency_locale'] = array(
    '#input' => TRUE,
    '#process' => array(
      'currency_form_currency_locale_process',
    ),
    '#element_validate' => array(
      'currency_form_currency_locale_validate',
    ),
  );

  // An element to set a currency sign.
  $elements['currency_sign'] = array(
    '#input' => TRUE,
    '#process' => array(
      'currency_form_currency_sign_process',
    ),
    '#element_validate' => array(
      'currency_form_currency_sign_validate',
    ),
    // The ISO 4217 code of the currency which signs to suggest to the user.
    // Optional.
    '#currency_code' => FALSE,
  );
  return $elements;
}