You are here

function nodewords_taxonomy in Nodewords: D6 Meta Tags 6.3

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

Implements hook_taxonomy().

File

./nodewords.module, line 171
Implement an version that other modules can use to add meta tags.

Code

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