You are here

public function Node::setSticky in Drupal 8

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

Sets the node sticky status.

Parameters

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

Return value

$this The called node entity.

Overrides NodeInterface::setSticky

File

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

Class

Node
Defines the node entity class.

Namespace

Drupal\node\Entity

Code

public function setSticky($sticky) {
  $this
    ->set('sticky', $sticky ? NodeInterface::STICKY : NodeInterface::NOT_STICKY);
  return $this;
}