You are here

function galleria_nodeapi in Galleria 6

Implementation of hook_nodeapi().

Creates Gallerias from attached files. CCK imagefield is done via an output formatter.

File

./galleria.module, line 204
Turns a node into a Galleria image gallery.

Code

function galleria_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'view':
      if (variable_get("galleria_{$node->type}", 0) == 1) {
        if ($page) {
          if (galleria_is_valid($node)) {

            // this is a galleria node, so perform modifications!
            galleria_includes();
            $node->content['galleria']['#value'] = theme('galleria_files', $node);
            $node->content['galleria']['#weight'] = module_exists('content') ? content_extra_field_weight($node->type, "galleria") : -10;
            unset($node->content['files']);
          }
        }
        else {
          galleria_set_message(t('Gallerias only display when viewing a node by itself on the page. See README.txt for help.'), 'warning');
        }
      }
  }
}