function EntityPublishedInterface::setPublished

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityPublishedInterface.php \Drupal\Core\Entity\EntityPublishedInterface::setPublished()
  2. 10 core/lib/Drupal/Core/Entity/EntityPublishedInterface.php \Drupal\Core\Entity\EntityPublishedInterface::setPublished()
  3. 11.x core/lib/Drupal/Core/Entity/EntityPublishedInterface.php \Drupal\Core\Entity\EntityPublishedInterface::setPublished()

Sets the entity as published.

Parameters

bool|null $published: (optional and deprecated) TRUE to set this entity to published, FALSE to set it to unpublished. Defaults to NULL. This parameter is deprecated in Drupal 8.3.0 and will be removed before Drupal 9.0.0. Use this method, without any parameter, to set the entity as published and setUnpublished() to set the entity as unpublished.

Return value

$this

See also

\Drupal\Core\Entity\EntityPublishedInterface::setUnpublished()

File

core/lib/Drupal/Core/Entity/EntityPublishedInterface.php, line 32

Class

EntityPublishedInterface
Provides an interface for access to an entity's published state.

Namespace

Drupal\Core\Entity

Code

public function setPublished($published = NULL);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.