You are here

function _node_gallery_delete in Node Gallery 6.2

Same name and namespace in other branches
  1. 6.3 node_gallery.module \_node_gallery_delete()
  2. 6 node_gallery.module \_node_gallery_delete()

Implementation of hook_nodeapi(op='delete').

1 call to _node_gallery_delete()
node_gallery_nodeapi in ./node_gallery.module
Implementation of hook_nodeapi().

File

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

Code

function _node_gallery_delete(&$node) {
  global $user;
  if (in_array($node->type, (array) node_gallery_get_types())) {
    $images = node_gallery_get_all_images($node);
    if (!empty($images)) {
      $operations[] = array(
        'image_delete_process',
        array(
          $images,
        ),
      );
      $batch = array(
        'operations' => $operations,
        'finished' => 'image_process_finished',
        'title' => t('Processing Gallery Delete.'),
        'init_message' => t('Gallery Delete is starting.'),
        //'progress_message' => t('Processed @current out of @total.'),
        'error_message' => t('Gallery Delete has encountered an error.'),
      );
      batch_set($batch);
      $redirect = user_access(NODE_GALLERY_PERM_VIEW_GALLERY) ? 'galleries/' . $user->uid : NULL;
      batch_process($redirect);
    }
  }
  if (in_array($node->type, (array) node_gallery_get_types('image'))) {
    node_gallery_delete_image($node);
  }
}