You are here

function nodewords_nodeapi in Nodewords: D6 Meta Tags 5

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

Implementation of hook_nodeapi().

File

./nodewords.module, line 134
Assign META tags to nodes, vocabularies, terms and pages.

Code

function nodewords_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'delete':
      if (user_access('edit meta tags')) {
        _nodewords_delete('node', $node->nid);
      }
      break;
    case 'insert':
    case 'update':
      if (isset($node->nodewords) && user_access('edit meta tags')) {
        _nodewords_set('node', $node->nid, $node->nodewords);
      }
      break;
    case 'update index':
      $output = '<h2>' . $node->nodewords['keywords'] . '</h2>';
      $output .= '<h3>' . $node->nodewords['description'] . '</h3>';
      return $output;
    case 'load':
      $node->nodewords = _nodewords_load('node', $node->nid);
      break;
  }
}