You are here

function gallery_assist_item_delete_confirm in Gallery Assist 7

Menu callback -- ask for confirmation of node deletion

1 string reference to 'gallery_assist_item_delete_confirm'
gallery_assist_menu in ./gallery_assist.module
Implements hook_menu().

File

./gallery_assist.module, line 495
Extend drupal with gallery functionalities. Manage galleries.

Code

function gallery_assist_item_delete_confirm($form = array(), $form_state = array(), $node = NULL, $pid = NULL, $action = NULL) {
  $node = $form_state['build_info']['args'][0];
  if (empty($pid)) {
    $pid = $form_state['build_info']['args'][1];
  }
  $form['#node'] = $node;

  //  // Always provide entity id in the same form key as in the entity edit form.
  //  $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
  $form['pid'] = array(
    '#type' => 'value',
    '#value' => $node->ga_items[$pid]->pid,
  );
  $form['fid'] = array(
    '#type' => 'value',
    '#value' => $node->ga_items[$pid]->fid,
  );
  $form['gid'] = array(
    '#type' => 'value',
    '#value' => $node->ga_items[$pid]->gid,
  );
  $form['gref'] = array(
    '#type' => 'value',
    '#value' => $node->ga_items[$pid]->gref,
  );
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $node->ga_items[$pid]->nid,
  );
  $form['count'] = array(
    '#type' => 'value',
    '#value' => $node->ga_conf[$node->type]['gallcount'],
  );
  return confirm_form($form, t('Are you sure you want to delete %title?', array(
    '%title' => $node->ga_items[$pid]->ptitle,
  )), 'node/' . $node->nid . '/' . $pid . '/edit', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}