You are here

public function Node::setPublished in Zircon Profile 8

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

Sets the published status of a node..

Parameters

bool $published: TRUE to set this node to published, FALSE to set it to unpublished.

Return value

\Drupal\node\NodeInterface The called node entity.

Overrides NodeInterface::setPublished

File

core/modules/node/src/Entity/Node.php, line 256
Contains \Drupal\node\Entity\Node.

Class

Node
Defines the node entity class.

Namespace

Drupal\node\Entity

Code

public function setPublished($published) {
  $this
    ->set('status', $published ? NODE_PUBLISHED : NODE_NOT_PUBLISHED);
  return $this;
}