function entity_revision_set_default in Entity API 7
Sets a given entity revision as default revision.
Note that the default revision flag will only be supported by entity types based upon the EntityAPIController, i.e. implementing the EntityAPIControllerRevisionableInterface.
Parameters
$entity_type: The type of the entity.
$entity: The entity revision to update.
See also
File
- ./
entity.module, line 445
Code
function entity_revision_set_default($entity_type, $entity) {
$info = entity_get_info($entity_type);
if (!empty($info['entity keys']['revision'])) {
$key = !empty($info['entity keys']['default revision']) ? $info['entity keys']['default revision'] : 'default_revision';
$entity->{$key} = TRUE;
}
}