You are here

function eck_revision_revision_delete_confirm in ECK Revision 7

Asks for confirmation of the deletion to prevent against CSRF attacks.

1 string reference to 'eck_revision_revision_delete_confirm'
eck_revision_menu in ./eck_revision.module
Implements hook_menu().

File

./eck_revision.pages.inc, line 147
Page callbacks for revisions management for entities.

Code

function eck_revision_revision_delete_confirm($form, $form_state, $entity_type, $entity_id, $revision_id) {

  // If Entity ID is entity object then set ID.
  if (is_object($entity_id)) {
    $entity_id = $entity_id->id;
  }

  // Load revision
  $revision = entity_revision_load($entity_type, array(
    $revision_id,
  ));

  // Validate that revision exists.
  if (empty($revision)) {
    drupal_not_found();
    return;
  }
  $crud_info = get_bundle_crud_info($entity_type, $revision->type);
  $path = eck_revision_get_real_path($crud_info['view']['path'], $revision);
  $form['#entity_type'] = $entity_type;
  $form['#entity_id'] = $entity_id;
  $form['#revision'] = $revision;
  $form['#path'] = $path;
  return confirm_form($form, t('Are you sure you want to delete the revision %num?', array(
    '%num' => $revision_id,
  )), $path . '/revisions', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}