function replicate_entity in Replicate 7
Replicate the entity passed in argument and save it.
Parameters
string $entity_type: The entity type.
object $entity: The entity to replicate.
Return value
mixed The newly created entity id if the clone has been created and saved, else FALSE.
1 call to replicate_entity()
- replicate_entity_by_id in ./
replicate.module - Replicate the entity corresponding to the type and id passed in argument and save it.
File
- ./
replicate.module, line 41 - Main methods of Replicate module.
Code
function replicate_entity($entity_type, $entity) {
$clone = replicate_clone_entity($entity_type, $entity);
if ($clone) {
entity_save($entity_type, $clone);
list($entity_id) = entity_extract_ids($entity_type, $clone);
if (isset($entity_id)) {
module_invoke_all('replicate_entity_after_save', $clone, $entity_type, $entity);
return $entity_id;
}
}
return FALSE;
}