You are here

function commerce_price_field_data_property_info in Commerce Core 7

Defines info for the properties of the Price field data structure.

2 calls to commerce_price_field_data_property_info()
commerce_price_property_info_callback in modules/price/commerce_price.module
Callback to alter the property info of price fields.
commerce_price_rules_data_info in modules/price/commerce_price.rules.inc
Implements hook_rules_data_info().

File

modules/price/commerce_price.module, line 793
Defines the Price field with widgets and formatters used to add prices with currency codes to various Commerce entities.

Code

function commerce_price_field_data_property_info($name = NULL) {
  return array(
    'amount' => array(
      'label' => t('Amount'),
      'description' => !empty($name) ? t('Amount value of field %name', array(
        '%name' => $name,
      )) : '',
      'type' => 'decimal',
      'getter callback' => 'entity_property_verbatim_get',
      'setter callback' => 'entity_property_verbatim_set',
    ),
    'amount_decimal' => array(
      'label' => t('Amount (decimal)'),
      'description' => !empty($name) ? t('Amount value of field %name (as a decimal)', array(
        '%name' => $name,
      )) : '',
      'type' => 'decimal',
      'getter callback' => 'commerce_price_amount_decimal_get',
      'computed' => TRUE,
    ),
    'currency_code' => array(
      'label' => t('Currency'),
      'description' => !empty($name) ? t('Currency code of field %name', array(
        '%name' => $name,
      )) : '',
      'type' => 'text',
      'getter callback' => 'entity_property_verbatim_get',
      'setter callback' => 'entity_property_verbatim_set',
      'options list' => 'commerce_currency_code_options_list',
    ),
    'data' => array(
      'label' => t('Data'),
      'description' => !empty($name) ? t('Data array of field %name', array(
        '%name' => $name,
      )) : '',
      'type' => 'struct',
      'getter callback' => 'entity_property_verbatim_get',
      'setter callback' => 'entity_property_verbatim_set',
    ),
  );
}