You are here

function _node_gallery_delete in Node Gallery 6

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

Implementation of hook_nodeapi(op='delete').

File

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

Code

function _node_gallery_delete(&$node) {
  global $user;
  if (gallery_config_gateway::get_types('gallery', $node->type)) {
    gallery_gateway::delete($node->nid);
    if (!empty($node->images)) {
      foreach ($node->images as $image) {
        $operations[] = array(
          'images_delete_process',
          array(
            $image,
          ),
        );
      }
      $batch = array(
        'operations' => $operations,
        'finished' => 'images_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);
      batch_process('galleries/' . $user->uid);
    }
  }
  if (gallery_config_gateway::get_types('image', $node->type)) {
    ImageGateway::delete($node);
  }
}