You are here

function exclude_node_title_nodeapi in Exclude Node Title 6

Implementation of hook_nodeapi().

File

./exclude_node_title.module, line 98
Primarily Drupal hooks and global API functions to exclude node titles.

Code

function exclude_node_title_nodeapi(&$node, $op) {
  switch ($op) {
    case 'view':
      if (variable_get('exclude_node_title_remove_title', 0) == 0 && !(arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) || !user_access('use exclude node title')) {
        return;
      }
      if (in_array($node->nid, variable_get('exclude_node_title_nid_list', array()))) {
        $node->title = '';
      }
      else {
        $exclude_node_title_content_type = exclude_node_title_content_type();
        if (!empty($exclude_node_title_content_type[$node->type])) {
          $node->title = '';
        }
      }
      break;
    case 'delete':
      exclude_node_title_set_flag($node, 0);
      break;
    case 'insert':
    case 'update':
      if (isset($node->exclude_node_title) && exclude_node_title_check_perm($node)) {
        exclude_node_title_set_flag($node, $node->exclude_node_title);
      }
      break;
  }
}