You are here

function og_vocab_nodeapi in OG Vocabulary 6

Same name and namespace in other branches
  1. 5 og_vocab.module \og_vocab_nodeapi()

Implementation of hook_nodeapi().

File

./og_vocab.module, line 153
Give each group its own system controlled vocabularies.

Code

function og_vocab_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'load':
      if (og_is_group_type($node->type)) {
        $node->og_vocabularies = og_vocab_get_vocabularies($node->nid);
      }
      break;
    case 'delete':
      if (og_is_group_type($node->type)) {
        og_vocab_remove_all_records($node->nid);
        foreach ($node->og_vocabularies as $vocabulary) {
          taxonomy_del_vocabulary($vocabulary->vid);
        }
      }
      break;
  }
}