Node::setPublished

public Node::setPublished($published)

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 255

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;
}
doc_Drupal
2016-10-29 09:30:24
Comments
Leave a Comment

Please login to continue.