You are here

bean_uuid.module in Bean (for Drupal 7) 7

Implement UUID/Entity hooks for integrating with deploy and other modules.

File

bean_uuid/bean_uuid.module
View source
<?php

/**
 * @file
 * Implement UUID/Entity hooks for integrating with deploy and other modules.
 */

/**
 * Implements hook_entity_info_alter().
 */
function bean_uuid_entity_info_alter(&$entity_info) {

  // Set the properties bellow for bean entity so UUIDs get created on sync.
  $entity_info['bean']['uuid'] = TRUE;
  $entity_info['bean']['entity keys']['uuid'] = 'uuid';
  $entity_info['bean']['entity keys']['revision uuid'] = 'vuuid';
}

/**
 * Implements bean_presave().
 */
function bean_uuid_bean_presave($bean) {
  if (!empty($bean->is_new_revision)) {
    $bean->vuuid = uuid_generate();
  }
}

Functions

Namesort descending Description
bean_uuid_bean_presave Implements bean_presave().
bean_uuid_entity_info_alter Implements hook_entity_info_alter().