You are here

function image_gallery_nodeapi in Image 5

Same name and namespace in other branches
  1. 5.2 contrib/image_gallery/image_gallery.module \image_gallery_nodeapi()
  2. 6 contrib/image_gallery/image_gallery.module \image_gallery_nodeapi()
  3. 7 contrib/image_gallery/image_gallery.module \image_gallery_nodeapi()

File

contrib/image_gallery/image_gallery.module, line 111

Code

function image_gallery_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'view':
      if ($page && !$teaser && $node->type == 'image') {
        $vid = _image_gallery_get_vid();
        $terms = taxonomy_node_get_terms_by_vocabulary($node->nid, $vid);
        $term = array_pop($terms);
        if ($term) {
          $vocabulary = taxonomy_get_vocabulary($vid);

          // Breadcrumb navigation
          $breadcrumb = array();
          $breadcrumb[] = array(
            'path' => 'image',
            'title' => $vocabulary->name,
          );
          if ($parents = taxonomy_get_parents_all($term->tid)) {
            $parents = array_reverse($parents);
            foreach ($parents as $p) {
              $breadcrumb[] = array(
                'path' => 'image/tid/' . $p->tid,
                'title' => $p->name,
              );
            }
          }
          $breadcrumb[] = array(
            'path' => 'node/' . $node->nid,
          );
          menu_set_location($breadcrumb);
        }
      }
      break;
  }
}