You are here

function commerce_price_components_field_data_property_info in Commerce price by components 7

2 calls to commerce_price_components_field_data_property_info()
commerce_price_components_property_info_callback in ./commerce_price_components.module
commerce_price_components_rules_data_info_alter in ./commerce_price_components.rules.inc
Implements hook_rules_data_info_alter().

File

./commerce_price_components.module, line 157
Module file for Price by components.

Code

function commerce_price_components_field_data_property_info($name = NULL) {
  $property_info = commerce_price_field_data_property_info($name);
  foreach (commerce_price_component_titles() as $component_name => $title) {
    $property_info[$component_name] = array(
      'label' => $title,
      'description' => !empty($name) ? t('Component %component_name of field %name', array(
        '%component_name' => $component_name,
        '%name' => $name,
      )) : '',
      'type' => 'commerce_price',
      'getter callback' => 'commerce_price_components_get_components',
      'property info' => array(
        'amount' => array(
          'label' => t('Amount'),
          'description' => !empty($name) ? t('Amount value of field %name', array(
            '%name' => $name,
          )) : '',
          'type' => 'decimal',
          'getter callback' => 'commerce_price_components_get_component',
          'setter callback' => 'entity_property_verbatim_set',
        ),
        'currency_code' => array(
          'label' => t('Currency'),
          'description' => !empty($name) ? t('Currency code of field %name', array(
            '%name' => $name,
          )) : '',
          'type' => 'text',
          'getter callback' => 'commerce_price_components_get_component',
          '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' => 'commerce_price_components_get_component',
          'setter callback' => 'entity_property_verbatim_set',
        ),
      ),
    );
  }
  return $property_info;
}