You are here

function exclude_node_title_set_flag in Exclude Node Title 7

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

Set exclude_node_title flag for the given node.

3 calls to exclude_node_title_set_flag()
exclude_node_title_node_delete in ./exclude_node_title.module
Implements hook_node_delete().
exclude_node_title_node_insert in ./exclude_node_title.module
Implements hook_node_insert().
exclude_node_title_node_update in ./exclude_node_title.module
Implements hook_node_update().

File

./exclude_node_title.module, line 232
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;
  }
}