function webform_entity_uuid_presave in Webform UUID 7
Implements hook_entity_uuid_presave().
File
- ./webform_uuid.module, line 61 
- Code for the Webform UUID module.
Code
function webform_entity_uuid_presave(&$entity, $entity_type) {
  // Only edit nodes that have webforms.
  if ($entity_type != 'node' || empty($entity->webform)) {
    return;
  }
  $entity->webform['nid'] = current(entity_get_id_by_uuid($entity_type, array(
    $entity->webform['nid'],
  )));
  foreach ($entity->webform['components'] as $i => $component) {
    $entity->webform['components'][$i]['nid'] = $entity->webform['nid'];
  }
  foreach ($entity->webform['emails'] as $i => $email) {
    $entity->webform['emails'][$i]['nid'] = $entity->webform['nid'];
  }
}