You are here

function exclude_node_title_set_flag in Exclude Node Title 8

Same name and namespace in other branches
  1. 6 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.

5 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().
exclude_node_title_preprocess_page in ./exclude_node_title.module
Implements hook_preprocess_page().
exclude_node_title_preprocess_page_title in ./exclude_node_title.module
Implements hook_preprocess_page_title().

File

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

Code

function exclude_node_title_set_flag($node, $value = 1) {
  $exclude_manager = \Drupal::service('exclude_node_title.manager');
  if ($value === 1 && !$exclude_manager
    ->isNodeExcluded($node)) {
    $exclude_manager
      ->addNodeToList($node);
  }
  if ($value === 0 && $exclude_manager
    ->isNodeExcluded($node)) {
    $exclude_manager
      ->removeNodeFromList($node);
  }
}