You are here

function replicate_ui_replicate_entity in Replicate UI 7

The action function for the 'replicate_ui_replicate_entity'.

File

./replicate_ui.rules.inc, line 103
Replicate Rules code: actions, conditions and events.

Code

function replicate_ui_replicate_entity($type, $id) {
  $toclone = entity_load_single($type, $id);
  $toclone->id = null;
  $new = replicate_entity($type, $toclone);
  if ($new) {
    drupal_set_message(t('Entity @title has been replicated!', array(
      '@title' => $toclone->title,
    )));
    return array(
      'replica_entity' => $new,
    );
  }
}