You are here

function node_gallery_form_node_delete_confirm_alter in Node Gallery 6.3

File

./node_gallery.module, line 513
Node gallery module file.

Code

function node_gallery_form_node_delete_confirm_alter(&$form, &$form_state) {
  $node = node_load($form['nid']['#value']);
  if (isset($node->gid) && in_array($node->type, (array) node_gallery_get_types('image'))) {
    $form['#redirect'] = 'node/' . $node->gid;
  }
  elseif (in_array($node->type, (array) node_gallery_get_types('gallery'))) {
    $count = node_gallery_get_image_count($node->nid);
    if ($count > 0) {
      $form['description']['#value'] = format_plural($count, 'This action will delete the 1 image contained within this gallery and cannot be undone.', 'This action will delete the @count images contained within this gallery and cannot be undone.');
    }
  }
}