You are here

function commerce_registration_update_entity_settings in Commerce Registration 7.3

Update settings for the given entity.

1 call to commerce_registration_update_entity_settings()
commerce_registration_node_form_submit in ./commerce_registration.module
Node form submit handler to update our entity settings.

File

./commerce_registration.module, line 415
Commerce Registration module code.

Code

function commerce_registration_update_entity_settings($entity_type, $entity, $settings) {
  $default_settings = module_invoke_all('commerce_registration_entity_settings', $entity_type, $entity);
  list($entity_id, , $bundle) = entity_extract_ids($entity_type, $entity);
  $settings = array_unique(array_merge($default_settings, $settings));
  db_merge('commerce_registration_settings')
    ->key(array(
    'entity_type' => $entity_type,
    'entity_id' => $entity_id,
    'entity_bundle' => $bundle,
  ))
    ->fields(array(
    'entity_type' => $entity_type,
    'entity_id' => $entity_id,
    'entity_bundle' => $bundle,
    'settings' => serialize($settings),
  ))
    ->execute();
}