public function Drafty::saveRevisionAsNew in Drafty 7
Save a revision as new.
Parameters
$type: The entity type.
$revision: An entity object.
Return value
The newly saved revision.
1 call to Drafty::saveRevisionAsNew()
- Drafty::publishRevision in ./
drafty.module - Publish a revision.
File
- ./
drafty.module, line 310 - Hook implementations and API functions for the Drafty module.
Class
- Drafty
- Handles tracking, selecting and publishing revisions.
Code
public function saveRevisionAsNew($type, $revision) {
list($id) = entity_extract_ids($type, $revision);
entity_get_controller($type)
->resetCache();
$original = entity_load_single($type, $id);
$revision->original = $original;
// @todo: entity API function?
$revision->revision = TRUE;
$revision->is_new_revision = TRUE;
$revision->default_revision = TRUE;
entity_save($type, $revision);
return $revision;
}