You are here

function exclude_node_title_set_flag in Exclude Node Title 6

Same name and namespace in other branches
  1. 8 exclude_node_title.module \exclude_node_title_set_flag()
  2. 7 exclude_node_title.module \exclude_node_title_set_flag()

Set exclude_node_title flag for the given node.

1 call to exclude_node_title_set_flag()
exclude_node_title_nodeapi in ./exclude_node_title.module
Implementation of hook_nodeapi().

File

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

Code

function exclude_node_title_set_flag($node, $value = 1) {
  $exclude_list = variable_get('exclude_node_title_nid_list', array());
  $is_excluded = array_search($node->nid, $exclude_list);
  if ($value == 1 && $is_excluded === FALSE) {
    $exclude_list[] = $node->nid;
    variable_set('exclude_node_title_nid_list', $exclude_list);
    return;
  }
  if ($value == 0 && $is_excluded !== FALSE) {
    unset($exclude_list[$is_excluded]);
    variable_set('exclude_node_title_nid_list', $exclude_list);
    return;
  }
}