You are here

function hook_replicate_entity_after_save in Replicate 7

Alter the replica right after it has been saved.

This hook is called at the end of the operations of replicate_entity() (and so replicate_entity_by_id) function, allowing to alter the replicate before it is returned to the caller. This function will not apply to replication directly using replicate_clone_entity and replicate_clone_entity_by_id as these functions don't save entities.

This hook is meant to be used to trigger other actions, not modifying the replicated entity. For that use hook_replicate_entity_alter().

Parameters

object $replica: Reference to the fully loaded entity object being saved (the clone) that can be altered as needed.

string $entity_type: Type of the entity containing the field.

object $original: The fully loaded original entity object.

See also

replicate_clone_entity()

drupal_alter()

1 invocation of hook_replicate_entity_after_save()
replicate_entity in ./replicate.module
Replicate the entity passed in argument and save it.

File

./replicate.api.php, line 74
API documentation for the Replicate module.

Code

function hook_replicate_entity_after_save($replica, $entity_type, $original) {

  // Do something common to all entities that are replicated.
  $wrapper = entity_metadata_wrapper($entity_type, $replica);
  $wrapper->field_is_replica
    ->set(TRUE);
}