Created
September 8, 2012 07:19
-
-
Save cotto/3672527 to your computer and use it in GitHub Desktop.
spot the bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements of hook_entity_property_info_alter(). | |
* | |
* This adds the UUID as an entity property for all UUID-enabled entities | |
* which automatically gives us token and Rules integration. | |
*/ | |
function uuid_entity_property_info_alter(&$info) { | |
foreach (entity_get_info() as $entity_type => $info) { | |
if (isset($info['uuid']) && $info['uuid'] == TRUE && !empty($info['entity keys']['uuid'])) { | |
$info[$entity_type]['properties'][$info['entity keys']['uuid']] = array( | |
'label' => t('UUID'), | |
'type' => 'text', | |
'description' => t('The universally unique ID.'), | |
'schema field' => $info['entity keys']['uuid'], | |
); | |
if (!empty($info['entity keys']['revision uuid'])) { | |
$info[$entity_type]['properties'][$info['entity keys']['revision uuid']] = array( | |
'label' => t('Revision UUID'), | |
'type' => 'text', | |
'description' => t("The revision's universally unique ID."), | |
'schema field' => $info['entity keys']['revision uuid'], | |
); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment