You are here

public function ExcludeNodeTitleManager::addNodeToList in Exclude Node Title 8

Adds node to exclude list.

Parameters

mixed $param: Can be a node object or integer value (nid).

Overrides ExcludeNodeTitleManagerInterface::addNodeToList

File

src/ExcludeNodeTitleManager.php, line 278

Class

ExcludeNodeTitleManager
Service class for Exclude Node Title module settings management.

Namespace

Drupal\exclude_node_title

Code

public function addNodeToList($param) {
  if ($param instanceof NodeInterface) {
    $param = $param
      ->id();
  }
  if (!is_numeric($param)) {
    return FALSE;
  }
  $exclude_list = $this
    ->getExcludedNodes();
  if (!in_array($param, $exclude_list)) {
    $exclude_list[] = $param;
    $this->settingsConfig
      ->set('nid_list', $exclude_list)
      ->save();
  }
  return $this;
}