Created
December 24, 2009 17:23
-
-
Save anarchivist/263275 to your computer and use it in GitHub Desktop.
UUID Computed Field for Drupal
This file contains hidden or 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
| <?php | |
| /* Autopopulates a Drupal Computed Field [1] CCK field using the UUID module [2]. | |
| Requires the 6.x-1.x-dev version of the module UUID, with a specific patch [3]. | |
| It assumes that you only want to generate UUIDs once. It probably should be | |
| abstracted into another CCK module, but I'm too lazy to do that at the moment. | |
| [1] http://drupal.org/project/computed_field | |
| [2] http://drupal.org/project/uuid | |
| [3] http://drupal.org/node/502622#comment-1858190 | |
| */ | |
| if (empty($node_field[0]['value'])) { | |
| $node_field[0]['value'] = uuid_uuid(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment