You are here

function node_gallery_nodeapi in Node Gallery 6.2

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

Implementation of hook_nodeapi().

File

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

Code

function node_gallery_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'load':
      if (in_array($node->type, (array) node_gallery_get_types())) {

        // If we are sorting images, we don't want to load the pager
        if (arg(2) == 'sort' || arg(2) == 'images') {
          $node->images = node_gallery_get_gallery_images($node, TRUE);
        }
        else {
          $node->images = node_gallery_get_gallery_images($node);
        }
        $node->config = node_gallery_get_config($node->type);
      }
      if (in_array($node->type, (array) node_gallery_get_types('image'))) {

        //$node->image = node_gallery_get_image_file($node);
        $node = (object) array_merge((array) $node, (array) node_gallery_get_image_file($node));
      }
      break;
    case 'view':

      //viewing node gallery page.
      if (in_array($node->type, (array) node_gallery_get_types())) {
        _node_gallery_gallery_view($node, $a3, $a4);
      }
      elseif (in_array($node->type, (array) node_gallery_get_types('image'))) {
        _node_gallery_image_view($node, $a3, $a4);
      }
      break;
    case 'delete':
      _node_gallery_delete($node);
      break;
  }
}