You are here

function uuid_token_info_alter in Universally Unique IDentifier 7

Implements hook_token_info_alter().

File

./uuid.tokens.inc, line 34
Builds placeholder replacement tokens for uuid-related data.

Code

function uuid_token_info_alter(&$data) {
  foreach (entity_get_info() as $entity_type => $info) {
    if (isset($info['uuid']) && $info['uuid'] == TRUE && !empty($info['entity keys']['uuid'])) {
      $token_type = !empty($info['token type']) ? $info['token type'] : $entity_type;
      if (empty($data['types'][$token_type])) {
        unset($data['tokens'][$token_type]);
      }
    }
  }
}