You are here

function hook_replicate_entity_alter in Replicate 7

Alter the replica before returning it (and before entity is saved).

This hook is called at the end of the operations of replicate_clone_entity() function, allowing to alter the replicate before it is returned to the caller. This function will apply to all replicated entities.

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_alter()
replicate_clone_entity in ./replicate.module
Replicate the entity passed in argument.

File

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

Code

function hook_replicate_entity_alter(&$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);
}