You are here

function commerce_option_get_valuables in Commerce Product Option 7.2

Extract from our Commerce Options the stuff we need to compare to other options to determine if an option is unique. These should be all the fields defined in the option set, but it could also include custom things, defined by other modules.

3 calls to commerce_option_get_valuables()
commerce_option_add_to_cart_submit in ./commerce_option.module
Cart submit callback function. This is required to create / update the option related to the line item.
commerce_option_entity_load in ./commerce_option.module
Implements hook_entity_load().
commerce_option_field_attach_submit in ./commerce_option.module
Implements hook_field_attach_submit().

File

./commerce_option.module, line 498

Code

function commerce_option_get_valuables($option) {
  $option_extracted = array();
  $fields = field_info_instances('commerce_option', $option->set_id);
  $fields = array_keys($fields);
  foreach ($fields as $field) {
    $option_extracted[$field] = $option->{$field};
  }

  // Let other modules define their own properties.
  drupal_alter('commerce_option_valuables', $option_extracted, $option);
  return $option_extracted;
}