Same name and namespace in other branches
  1. 8.9.x core/modules/node/src/Entity/Node.php \Drupal\node\Entity\Node::setPromoted()
  2. 9 core/modules/node/src/Entity/Node.php \Drupal\node\Entity\Node::setPromoted()

Sets the node promoted status.

Parameters

bool $promoted: TRUE to set this node to promoted, FALSE to set it to not promoted.

Return value

$this The called node entity.

Overrides NodeInterface::setPromoted

File

core/modules/node/src/Entity/Node.php, line 239

Class

Node
Defines the node entity class.

Namespace

Drupal\node\Entity

Code

public function setPromoted($promoted) {
  $this
    ->set('promote', $promoted ? NodeInterface::PROMOTED : NodeInterface::NOT_PROMOTED);
  return $this;
}