You are here

function nodewords_taxonomy in Nodewords: D6 Meta Tags 6

Same name and namespace in other branches
  1. 5 nodewords.module \nodewords_taxonomy()
  2. 6.3 nodewords.module \nodewords_taxonomy()
  3. 6.2 nodewords.module \nodewords_taxonomy()

Implements hook_taxonomy().

File

./nodewords.module, line 634
Implement an API that other modules can use to implement meta tags.

Code

function nodewords_taxonomy($op, $type, $array = NULL) {
  if (isset($array)) {
    if ($type == 'term') {
      $type = NODEWORDS_TYPE_TERM;
      $id = $array['tid'];
    }
    elseif ($type == 'vocabulary') {
      $type = NODEWORDS_TYPE_VOCABULARY;
      $id = $array['vid'];
    }
    else {
      return;
    }
    switch ($op) {
      case 'delete':
        nodewords_delete_tags($type, $id);
        break;
      case 'insert':
      case 'update':
        if (isset($array['nodewords'])) {
          nodewords_save_tags($type, $id, $array['nodewords'], TRUE);
        }
        break;
    }
  }
}