function commerce_uuid_entity_uuid_presave in Commerce UUID 7
Implements hook_entity_uuid_presave().
File
- ./
commerce_uuid.module, line 71 - Adds universally unique identifiers support to Drupal Commerce.
Code
function commerce_uuid_entity_uuid_presave(&$entity, $entity_type) {
if ($entity_type == 'commerce_customer_profile') {
entity_property_uuid_to_id($entity, 'user', 'uid');
}
if ($entity_type == 'commerce_line_item') {
entity_property_uuid_to_id($entity, 'commerce_order', array(
'order_id',
));
}
if ($entity_type == 'commerce_order') {
entity_property_uuid_to_id($entity, 'user', array(
'uid',
'revision_uid',
));
}
if ($entity_type == 'commerce_payment_transaction') {
entity_property_uuid_to_id($entity, 'user', 'uid');
entity_property_uuid_to_id($entity, 'commerce_order', 'order_id');
}
if ($entity_type == 'commerce_product') {
entity_property_uuid_to_id($entity, 'user', 'uid');
}
}