You are here

function replicate_ui_confirm in Replicate UI 7

Menu callback. Ask for confirmation of replication.

1 string reference to 'replicate_ui_confirm'
replicate_ui_menu in ./replicate_ui.module
Implements hook_menu().

File

./replicate_ui.module, line 144
Provide a user interface for the Replicate API.

Code

function replicate_ui_confirm($form, &$form_state, $type, $entity_id) {

  // convert from object to id if we got an object instead
  if (is_object($entity_id)) {
    $info = entity_get_info($type);
    $entity_id = $entity_id->{$info['entity keys']['id']};
  }

  // write id / type into form to pass to the submit handler
  $form['entity_id'] = array(
    '#type' => 'value',
    '#value' => $entity_id,
  );
  $form['entity_type'] = array(
    '#type' => 'value',
    '#value' => $type,
  );
  return confirm_form($form, t('Are you sure you want to replicate %type entity id %id?', array(
    '%type' => $type,
    '%id' => $entity_id,
  )), '', t('This action cannot be undone.'), t('Replicate'), t('Cancel'));
}