You are here

function _commerce_option_create in Commerce Product Option 7

Creation callback for the Entity module.

File

./commerce_option.module, line 112

Code

function _commerce_option_create($values = array()) {

  // Create a new product of the specified type.
  $option = commerce_product_new($values['set_id']);
  unset($values['set_id']);
  $wrapper = entity_metadata_wrapper('commerce_option', $option);
  foreach ($values as $name => $value) {
    $wrapper->{$name}
      ->set($value);
  }
  return $wrapper
    ->value();
}