You are here

function book_entity_uuid_presave in Universally Unique IDentifier 7

Implements hook_entity_uuid_presave().

Related topics

File

./uuid.core.inc, line 77
Implementation of UUID hooks for all core modules.

Code

function book_entity_uuid_presave(&$entity, $entity_type) {
  if ($entity_type == 'node') {
    if (!empty($entity->book)) {
      $entity->book['bid'] = current(entity_get_id_by_uuid($entity_type, array(
        $entity->book['bid'],
      )));
      if (!$entity->book['bid']) {
        $entity->book['bid'] = 'new';
      }
    }
  }
}